qseecom: add mutex around qseecom_set_client_mem_param

Add mutex around qseecom_set_client_mem_param to prevent an
ioctl thread modifying and corrupting data which is being
processed by another ioctl in the other thread

Change-Id: I0cfb8afab4001c2913be693dfe44c761b9568893
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
This commit is contained in:
Zhen Kong 2017-02-27 13:41:07 -08:00 committed by Flex1911
parent 06f8886176
commit 7a939ce286

View file

@ -2222,7 +2222,11 @@ static long qseecom_ioctl(struct file *file, unsigned cmd,
ret = -EINVAL;
break;
}
mutex_lock(&app_access_lock);
atomic_inc(&data->ioctl_count);
ret = qseecom_set_client_mem_param(data, argp);
atomic_dec(&data->ioctl_count);
mutex_unlock(&app_access_lock);
if (ret)
pr_err("failed Qqseecom_set_mem_param request: %d\n",
ret);