summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorZhen Kong <zkong@codeaurora.org>2016-02-17 15:32:03 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:20:46 -0700
commitf6b4ea8dca8c5baa98c1f3a768e39682b61f6438 (patch)
treed2e51ef1e20ca44cd80815e771abc20d35d1ce03 /drivers/misc
parentd3b5ab23737eb15c7a6581fd2b83bb6d2bab54a4 (diff)
qseecom: release ION memory if qseecom failed to unload app
To avoid memory leakage, make change to release ION memory if qseecom failed to unload TZ app, which is allocated when starting app. CRs-Fixed: 977073 Change-Id: Ic4c9a7d7a118ff5026ce6ce7769a4c053906ed2d Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/qseecom.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c
index d33b52000d6b..bcc264055083 100644
--- a/drivers/misc/qseecom.c
+++ b/drivers/misc/qseecom.c
@@ -2095,9 +2095,14 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
bool found_app = false;
bool found_dead_app = false;
+ if (!data) {
+ pr_err("Invalid/uninitialized device handle\n");
+ return -EINVAL;
+ }
+
if (!memcmp(data->client.app_name, "keymaste", strlen("keymaste"))) {
pr_debug("Do not unload keymaster app from tz\n");
- goto unload_exit;
+ return 0;
}
if (data->client.app_id > 0) {
@@ -2123,7 +2128,8 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
pr_err("Cannot find app with id = %d (%s)\n",
data->client.app_id,
(char *)data->client.app_name);
- return -EINVAL;
+ ret = -EINVAL;
+ goto unload_exit;
}
}
@@ -2146,14 +2152,16 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
if (ret) {
pr_err("scm_call to unload app (id = %d) failed\n",
req.app_id);
- return -EFAULT;
+ ret = -EFAULT;
+ goto unload_exit;
} else {
pr_warn("App id %d now unloaded\n", req.app_id);
}
if (resp.result == QSEOS_RESULT_FAILURE) {
pr_err("app (%d) unload_failed!!\n",
data->client.app_id);
- return -EFAULT;
+ ret = -EFAULT;
+ goto unload_exit;
}
if (resp.result == QSEOS_RESULT_SUCCESS)
pr_debug("App (%d) is unloaded!!\n",
@@ -2164,7 +2172,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data,
if (ret) {
pr_err("process_incomplete_cmd fail err: %d\n",
ret);
- return ret;
+ goto unload_exit;
}
}
}