qseecom: add mutex protection for unloading app in qseecom_release
When multiple processes called qseecom_release() to close /dev/qseecom
at almost the same time, and one process succeeded to unload app and
released resource, null pointer exception would occurr on another process.
So make change to add mutex_lock/mutex_unlock for qseecom_unload_app
in qseecom_release.
Change-Id: Ie7cf61b1d3ea5339ea79e0f7637ca610969e3d6c
CRs-fixed: 849916
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c
index 3402739..5d21a6b 100644
--- a/drivers/misc/qseecom.c
+++ b/drivers/misc/qseecom.c
@@ -4112,7 +4112,9 @@
ret = qseecom_unregister_listener(data);
break;
case QSEECOM_CLIENT_APP:
+ mutex_lock(&app_access_lock);
ret = qseecom_unload_app(data, true);
+ mutex_unlock(&app_access_lock);
break;
case QSEECOM_SECURE_SERVICE:
case QSEECOM_GENERIC: