From 3ecbc7ec46644dc7461740577957f39cbfa2da96 Mon Sep 17 00:00:00 2001 From: Zhen Kong Date: Mon, 16 May 2016 16:59:53 -0700 Subject: [PATCH] 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: Zhen Kong --- drivers/misc/qseecom.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index c994f7e00a16..7ea6635fbd41 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -2100,7 +2100,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data, if (!memcmp(data->client.app_name, "keymaste", strlen("keymaste"))) { pr_debug("Do not unload keymaster app from tz\n"); - return 0; + goto unload_exit; } __qseecom_cleanup_app(data); @@ -2152,7 +2152,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data, pr_err("scm_call to unload app (id = %d) failed\n", req.app_id); ret = -EFAULT; - goto not_release_exit; + goto unload_exit; } else { pr_warn("App id %d now unloaded\n", req.app_id); } @@ -2160,7 +2160,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data, pr_err("app (%d) unload_failed!!\n", data->client.app_id); ret = -EFAULT; - goto not_release_exit; + goto unload_exit; } if (resp.result == QSEOS_RESULT_SUCCESS) pr_debug("App (%d) is unloaded!!\n", @@ -2170,7 +2170,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data, if (ret) { pr_err("process_incomplete_cmd fail err: %d\n", ret); - goto not_release_exit; + goto unload_exit; } } } @@ -2200,7 +2200,6 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data, unload_exit: qseecom_unmap_ion_allocated_memory(data); data->released = true; -not_release_exit: return ret; }