summaryrefslogtreecommitdiff
path: root/drivers/misc/qseecom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/qseecom.c')
-rw-r--r--drivers/misc/qseecom.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c
index 3402a1b581cf..644178a0cdfc 100644
--- a/drivers/misc/qseecom.c
+++ b/drivers/misc/qseecom.c
@@ -3325,6 +3325,7 @@ static int __qseecom_update_cmd_buf_64(void *msg, bool cleanup,
}
}
len = QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT;
+ sg = sg_ptr->sgl;
goto cleanup;
}
sg = sg_ptr->sgl;
@@ -4091,12 +4092,21 @@ int qseecom_start_app(struct qseecom_handle **handle,
data->client.user_virt_sb_base = 0;
data->client.ihandle = NULL;
+ /* Allocate sglistinfo buffer for kernel client */
+ data->sglistinfo_ptr = kzalloc(SGLISTINFO_TABLE_SIZE, GFP_KERNEL);
+ if (!(data->sglistinfo_ptr)) {
+ kfree(data);
+ kfree(*handle);
+ *handle = NULL;
+ return -ENOMEM;
+ }
init_waitqueue_head(&data->abort_wq);
data->client.ihandle = ion_alloc(qseecom.ion_clnt, size, 4096,
ION_HEAP(ION_QSECOM_HEAP_ID), 0);
if (IS_ERR_OR_NULL(data->client.ihandle)) {
pr_err("Ion client could not retrieve the handle\n");
+ kfree(data->sglistinfo_ptr);
kfree(data);
kfree(*handle);
*handle = NULL;
@@ -4194,6 +4204,7 @@ int qseecom_start_app(struct qseecom_handle **handle,
return 0;
err:
+ kfree(data->sglistinfo_ptr);
kfree(data);
kfree(*handle);
*handle = NULL;
@@ -4241,6 +4252,7 @@ int qseecom_shutdown_app(struct qseecom_handle **handle)
mutex_unlock(&app_access_lock);
if (ret == 0) {
+ kzfree(data->sglistinfo_ptr);
kzfree(data);
kzfree(*handle);
kzfree(kclient);
@@ -7134,8 +7146,10 @@ static int qseecom_open(struct inode *inode, struct file *file)
atomic_set(&data->ioctl_count, 0);
data->sglistinfo_ptr = kzalloc(SGLISTINFO_TABLE_SIZE, GFP_KERNEL);
- if (!(data->sglistinfo_ptr))
+ if (!(data->sglistinfo_ptr)) {
+ kzfree(data);
return -ENOMEM;
+ }
return ret;
}
@@ -7999,8 +8013,10 @@ static int qseecom_check_whitelist_feature(void)
qseecom.whitelist_support = true;
ret = 0;
} else {
- pr_err("Failed to check whitelist: ret = %d, result = 0x%x\n",
+ pr_info("Check whitelist with ret = %d, result = 0x%x\n",
ret, resp.result);
+ qseecom.whitelist_support = false;
+ ret = 0;
}
kfree(buf);
return ret;