DivestOS/Patches/Linux_CVEs/CVE-2017-8242/ANY/0.patch
2017-10-29 22:14:37 -04:00

35 lines
1.1 KiB
Diff

From 6a3b8afdf97e77c0b64005b23fa6d32025d922e5 Mon Sep 17 00:00:00 2001
From: Zhen Kong <zkong@codeaurora.org>
Date: Mon, 27 Feb 2017 13:41:07 -0800
Subject: 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>
---
drivers/misc/qseecom.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/misc/qseecom.c b/drivers/misc/qseecom.c
index f8819e4..2a4cc5b 100644
--- a/drivers/misc/qseecom.c
+++ b/drivers/misc/qseecom.c
@@ -6982,7 +6982,11 @@ long qseecom_ioctl(struct file *file, unsigned cmd, unsigned long arg)
break;
}
pr_debug("SET_MEM_PARAM: qseecom addr = 0x%pK\n", data);
+ 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);
--
cgit v1.1