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

Commit cb4872d6 authored by Nitin LNU's avatar Nitin LNU Committed by Ravi Kumar Bokka
Browse files

qseecom: Release ion buffer in case of keymaster TA



For Keymaster TA we are not going to add it in to unload pending list
as we should not unload keymaster TA and as soon as unload request come
we should release Buffer and return.

Change-Id: Icba33195794aacde1c3b3ade5432fabbc27db608
Signed-off-by: default avatarNitin LNU <quic_nlakra@quicinc.com>
Signed-off-by: default avatarNageswara reddy Karnati <quic_nkarnati@quicinc.com>
parent 3dd11fd4
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -3153,6 +3153,30 @@ static int qseecom_prepare_unload_app(struct qseecom_dev_handle *data)
	pr_debug("prepare to unload app(%d)(%s), pending %d\n",
		data->client.app_id, data->client.app_name,
		data->client.unload_pending);

	/* For keymaster we are not going to unload so no need to add it in
	 * unload app pending list as soon as we identify release ion buffer
	 * and return .
	 */
	if (!memcmp(data->client.app_name, "keymaste", strlen("keymaste"))) {
		if (data->client.dmabuf) {
			/* Each client will get same KM TA loaded handle but
			 * will allocate separate shared buffer during
			 * loading of TA, as client can't unload KM TA so we
			 * will only free out shared buffer and return early
			 * to avoid any ion buffer leak.
			 */
			qseecom_vaddr_unmap(data->client.sb_virt,
				data->client.sgt, data->client.attach,
				data->client.dmabuf);
			MAKE_NULL(data->client.sgt,
				data->client.attach, data->client.dmabuf);
		}
		__qseecom_free_tzbuf(&data->sglistinfo_shm);
		data->released = true;
		return 0;
	}

	if (data->client.unload_pending)
		return 0;
	entry = kzalloc(sizeof(*entry), GFP_KERNEL);