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

Commit 2eef180d authored by Zhen Kong's avatar Zhen Kong
Browse files

qseecom: Fix ion memory issue during unload app failure



qseecom still need to free ion memory if unload app failed.
The previous xpu violation related to unload app failure is
actually due to race condition between send command, which
is fixed and now it is safe to free ion memory in error cases.

Change-Id: I7a09c753360eb015ece15c48ae1bb34e30479560
Signed-off-by: default avatarZhen Kong <zkong@codeaurora.org>
parent 0130e341
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -2214,7 +2214,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,


	if (!memcmp(data->client.app_name, "keymaste", strlen("keymaste"))) {
	if (!memcmp(data->client.app_name, "keymaste", strlen("keymaste"))) {
		pr_debug("Do not unload keymaster app from tz\n");
		pr_debug("Do not unload keymaster app from tz\n");
		return 0;
		goto unload_exit;
	}
	}


	__qseecom_cleanup_app(data);
	__qseecom_cleanup_app(data);
@@ -2266,7 +2266,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
			pr_err("scm_call to unload app (id = %d) failed\n",
			pr_err("scm_call to unload app (id = %d) failed\n",
								req.app_id);
								req.app_id);
			ret = -EFAULT;
			ret = -EFAULT;
			goto not_release_exit;
			goto unload_exit;
		} else {
		} else {
			pr_warn("App id %d now unloaded\n", req.app_id);
			pr_warn("App id %d now unloaded\n", req.app_id);
		}
		}
@@ -2274,7 +2274,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
			pr_err("app (%d) unload_failed!!\n",
			pr_err("app (%d) unload_failed!!\n",
					data->client.app_id);
					data->client.app_id);
			ret = -EFAULT;
			ret = -EFAULT;
			goto not_release_exit;
			goto unload_exit;
		}
		}
		if (resp.result == QSEOS_RESULT_SUCCESS)
		if (resp.result == QSEOS_RESULT_SUCCESS)
			pr_debug("App (%d) is unloaded!!\n",
			pr_debug("App (%d) is unloaded!!\n",
@@ -2284,7 +2284,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
			if (ret) {
			if (ret) {
				pr_err("process_incomplete_cmd fail err: %d\n",
				pr_err("process_incomplete_cmd fail err: %d\n",
									ret);
									ret);
				goto not_release_exit;
				goto unload_exit;
			}
			}
		}
		}
	}
	}
@@ -2314,7 +2314,6 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
unload_exit:
unload_exit:
	qseecom_unmap_ion_allocated_memory(data);
	qseecom_unmap_ion_allocated_memory(data);
	data->released = true;
	data->released = true;
not_release_exit:
	return ret;
	return ret;
}
}