Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 819ae535 authored by Dinesh K Garg's avatar Dinesh K Garg
Browse files

mink: handle error in local object response



When HLOS receives inbound request, it processes req and sends a
response. If for some reason, trusted execution environment finds
an error in it, it sends inbound request again with error set in
ret[1]. However, HLOS does not look at ret[1] because it is for
userspace's consumption. This results in an infinite loop.
As a fix, HLOS would look into ret[1] if it is a local object.

Change-Id: I189cad47ee95f6ea9a2ddb5507ad0ee7de9c60ec
Signed-off-by: default avatarDinesh K Garg <dineshg@codeaurora.org>
parent f08e34e4
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1081,6 +1081,19 @@ static int prepare_send_scm_msg(const uint8_t *in_buf, phys_addr_t in_paddr,
		if (desc.ret[0] != SMCINVOKE_RESULT_INBOUND_REQ_NEEDED)
			break;

		/*
		 * At this point we are convinced it is an inbnd req but it is
		 * possible that it is a resp to inbnd req that has failed and
		 * returned an err. Ideally scm_call should have returned err
		 * but err comes in  ret[1]. So check that out otherwise it
		 * could cause infinite loop.
		 */
		if (req->result &&
			desc.ret[0] == SMCINVOKE_RESULT_INBOUND_REQ_NEEDED) {
			ret = req->result;
			break;
		}

		dmac_inv_range(out_buf, out_buf + out_buf_len);

		if (desc.ret[0] == SMCINVOKE_RESULT_INBOUND_REQ_NEEDED) {