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>
bool whitelist_support;
bool commonlib_loaded;
bool commonlib64_loaded;
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;
struct ce_hw_usage_info ce_info;
int qsee_bw_count;
void *cmd_buf = NULL;
size_t cmd_len;
uint32_t app_arch = 0;
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");
if (!cmnlib_name) {
pr_err("cmnlib_name is NULL\n");
if (__qseecom_get_fw_size(cmnlib_name, &fw_size, &app_arch))
return -EIO;
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;
&img_data, fw_size, &pa);
if (ret)
return -EIO;
goto exit_unregister_bus_bw_need;
}
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) {
img_data, fw_size,
ION_IOC_CLEAN_INV_CACHES);
if (ret) {
- __qseecom_free_img_data(&qseecom.cmnlib_ion_handle);
+ __qseecom_free_img_data(&cmnlib_ion_handle);