From 3c7a360edf4a7976a636c2b7a594d9bbc2c96c7b Mon Sep 17 00:00:00 2001 From: Mona Hossain Date: Mon, 25 Feb 2013 09:32:33 -0800 Subject: [PATCH] qseecom: Fix kernel panic There exist a possibility for "handle" input being NULL. We need to check for this before dereferencing it. Change-Id: I50c1c6855ad303e05b52e6e37d774551d9db4fc4 Signed-off-by: Mona Hossain --- drivers/misc/qseecom.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 30449eb4438e..613ddd502ad9 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -1524,8 +1524,8 @@ EXPORT_SYMBOL(qseecom_start_app); int qseecom_shutdown_app(struct qseecom_handle **handle) { int ret = -EINVAL; - struct qseecom_dev_handle *data = - (struct qseecom_dev_handle *) ((*handle)->dev); + struct qseecom_dev_handle *data; + struct qseecom_registered_kclient_list *kclient = NULL; unsigned long flags = 0; bool found_handle = false; @@ -1534,11 +1534,11 @@ int qseecom_shutdown_app(struct qseecom_handle **handle) pr_err("This functionality is UNSUPPORTED in version 1.3\n"); return -EINVAL; } - if (*handle == NULL) { + if ((handle == NULL) || (*handle == NULL)) { pr_err("Handle is not initialized\n"); return -EINVAL; } - + data = (struct qseecom_dev_handle *) ((*handle)->dev); spin_lock_irqsave(&qseecom.registered_kclient_list_lock, flags); list_for_each_entry(kclient, &qseecom.registered_kclient_list_head, list) {