diff options
author | Zhen Kong <zkong@codeaurora.org> | 2017-10-18 10:27:20 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-12-02 08:17:10 -0800 |
commit | 6fadad98bf2467bc0f970ec79fe38c3b5e1d5379 (patch) | |
tree | de32db490a66e68a197167774b064206a7b0c473 /drivers | |
parent | 55cbbe687356eeb53256e8f8dc7f7daddae68272 (diff) |
qseecom: fix a common lib loading issue
cmnlib_ion_handle is only used within qseecom_load_commonlib_image()
and is not a shared resource, so change it to a local variable and
avoid potential reuse or free by another thread in case of reentrancy.
Change-Id: I9e1f25cd024a19a7379b7409bdc6521bcd8bcae5
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/qseecom.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c index 8c48a5c05bbe..aba9d269a102 100644 --- a/drivers/misc/qseecom.c +++ b/drivers/misc/qseecom.c @@ -252,7 +252,6 @@ struct qseecom_control { bool whitelist_support; bool commonlib_loaded; bool commonlib64_loaded; - struct ion_handle *cmnlib_ion_handle; struct ce_hw_usage_info ce_info; int qsee_bw_count; @@ -4291,6 +4290,7 @@ static int qseecom_load_commonlib_image(struct qseecom_dev_handle *data, void *cmd_buf = NULL; size_t cmd_len; uint32_t app_arch = 0; + struct ion_handle *cmnlib_ion_handle = NULL; if (!cmnlib_name) { pr_err("cmnlib_name is NULL\n"); @@ -4305,7 +4305,7 @@ static int qseecom_load_commonlib_image(struct qseecom_dev_handle *data, if (__qseecom_get_fw_size(cmnlib_name, &fw_size, &app_arch)) return -EIO; - ret = __qseecom_allocate_img_data(&qseecom.cmnlib_ion_handle, + ret = __qseecom_allocate_img_data(&cmnlib_ion_handle, &img_data, fw_size, &pa); if (ret) return -EIO; @@ -4346,7 +4346,7 @@ static int qseecom_load_commonlib_image(struct qseecom_dev_handle *data, goto exit_unregister_bus_bw_need; } - ret = msm_ion_do_cache_op(qseecom.ion_clnt, qseecom.cmnlib_ion_handle, + ret = msm_ion_do_cache_op(qseecom.ion_clnt, cmnlib_ion_handle, img_data, fw_size, ION_IOC_CLEAN_INV_CACHES); if (ret) { @@ -4394,7 +4394,7 @@ exit_unregister_bus_bw_need: } exit_free_img_data: - __qseecom_free_img_data(&qseecom.cmnlib_ion_handle); + __qseecom_free_img_data(&cmnlib_ion_handle); return ret; } |