mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-12-13 18:04:35 -05:00
56 lines
1.9 KiB
Diff
56 lines
1.9 KiB
Diff
From cd70f6025a7bbce89af7a7abf4c40a219fdea406 Mon Sep 17 00:00:00 2001
|
|
From: Zhen Kong <zkong@codeaurora.org>
|
|
Date: Fri, 4 Nov 2016 17:35:19 -0700
|
|
Subject: qseecom: remove entry from qseecom_registered_app_list
|
|
|
|
In an error handling case, the QSEECOM_IOCTL_LOAD_APP_REQ ioctl
|
|
freed the entry for new TA, but didn't removed it from
|
|
qseecom_registered_app_list. Make change to remove it.
|
|
|
|
Change-Id: Id681fbf3c923027d3db875d506cbe3f971919a8d
|
|
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
|
|
---
|
|
drivers/misc/qseecom.c | 11 ++++++++++-
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c
|
|
index db603f0..e9ebbee 100644
|
|
--- a/drivers/misc/qseecom.c
|
|
+++ b/drivers/misc/qseecom.c
|
|
@@ -2183,6 +2183,7 @@ static int qseecom_load_app(struct qseecom_dev_handle *data, void __user *argp)
|
|
struct qseecom_load_app_64bit_ireq load_req_64bit;
|
|
void *cmd_buf = NULL;
|
|
size_t cmd_len;
|
|
+ bool first_time = false;
|
|
|
|
/* Copy the relevant information needed for loading the image */
|
|
if (copy_from_user(&load_img_req,
|
|
@@ -2254,6 +2255,7 @@ static int qseecom_load_app(struct qseecom_dev_handle *data, void __user *argp)
|
|
&qseecom.registered_app_list_lock, flags);
|
|
ret = 0;
|
|
} else {
|
|
+ first_time = true;
|
|
pr_warn("App (%s) does'nt exist, loading apps for first time\n",
|
|
(char *)(load_img_req.img_name));
|
|
/* Get the handle of the shared fd */
|
|
@@ -2385,8 +2387,15 @@ static int qseecom_load_app(struct qseecom_dev_handle *data, void __user *argp)
|
|
load_img_req.app_id = app_id;
|
|
if (copy_to_user(argp, &load_img_req, sizeof(load_img_req))) {
|
|
pr_err("copy_to_user failed\n");
|
|
- kzfree(entry);
|
|
ret = -EFAULT;
|
|
+ if (first_time == true) {
|
|
+ spin_lock_irqsave(
|
|
+ &qseecom.registered_app_list_lock, flags);
|
|
+ list_del(&entry->list);
|
|
+ spin_unlock_irqrestore(
|
|
+ &qseecom.registered_app_list_lock, flags);
|
|
+ kzfree(entry);
|
|
+ }
|
|
}
|
|
|
|
loadapp_err:
|
|
--
|
|
cgit v1.1
|
|
|