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 <mhossain@codeaurora.org>
This commit is contained in:
Mona Hossain 2013-02-25 09:32:33 -08:00 committed by Iliyan Malchev
parent aa0368ee4f
commit 3c7a360edf

View file

@ -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) {