summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhen Kong <zkong@codeaurora.org>2016-05-16 16:59:53 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-02 15:25:23 -0700
commit3ecbc7ec46644dc7461740577957f39cbfa2da96 (patch)
tree1b0f429fb286272ea642f9ce4b0dd4d328378e74
parentec9fd7cc51bcc302aefe26e4cbfc7f4e2590918d (diff)
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 <zkong@codeaurora.org>
-rw-r--r--drivers/misc/qseecom.c9
1 files 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;
}