qseecom: Fix failure to release qseecom handle
qseecom_release() returns a failure, if it is unable to find app_id of zero, associated with the handle in the app list. There exists scenarios where the handle may not have the app_id initialized and remain to be 0. In these scenarios, once the uninitialized zero app_id is not found in the list, it returns a failure. Fix to this is look for non-zero valid app_id in the app_list when releasing the handle. Change-Id: I7b6489526da57cd2106f4aae9fdc0547e7a5fe86 Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
This commit is contained in:
committed by
Iliyan Malchev
parent
3c9617d2e7
commit
dc326510ef
@@ -784,7 +784,8 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data)
|
||||
bool unload = false;
|
||||
bool found_app = false;
|
||||
|
||||
if (qseecom.qseos_version == QSEOS_VERSION_14) {
|
||||
if ((qseecom.qseos_version == QSEOS_VERSION_14) &&
|
||||
(data->client.app_id > 0)) {
|
||||
spin_lock_irqsave(&qseecom.registered_app_list_lock, flags);
|
||||
list_for_each_entry(ptr_app, &qseecom.registered_app_list_head,
|
||||
list) {
|
||||
@@ -795,7 +796,7 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data)
|
||||
break;
|
||||
} else {
|
||||
ptr_app->ref_cnt--;
|
||||
pr_warn("Can't unload app with id %d (it is inuse)\n",
|
||||
pr_warn("Can't unload app(%d) inuse\n",
|
||||
ptr_app->app_id);
|
||||
break;
|
||||
}
|
||||
@@ -803,10 +804,11 @@ static int qseecom_unload_app(struct qseecom_dev_handle *data)
|
||||
}
|
||||
spin_unlock_irqrestore(&qseecom.registered_app_list_lock,
|
||||
flags);
|
||||
}
|
||||
if (found_app == false) {
|
||||
pr_err("Cannot find app with id = %d\n", data->client.app_id);
|
||||
return -EINVAL;
|
||||
if (found_app == false) {
|
||||
pr_err("Cannot find app with id = %d\n",
|
||||
data->client.app_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
if ((unload) && (qseecom.qseos_version == QSEOS_VERSION_14)) {
|
||||
|
||||
Reference in New Issue
Block a user