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

51 lines
1.7 KiB
Diff

From 970edf007fbe64b094437541a42477d653802d85 Mon Sep 17 00:00:00 2001
From: Benjamin Chan <bkchan@codeaurora.org>
Date: Mon, 6 Mar 2017 11:48:27 -0500
Subject: msm: mdss: Add lock to avoid release of active session in rotator
Add mutex lock to protect an active rotator session from being closed.
Without the lock, this can happen if a rotator closing IOCTL is
called from a separate thread.
CRs-Fixed: 2006159
Change-Id: I927a0c626bdae5ef149e12979ec4befdbac1b7f7
Signed-off-by: Benjamin Chan <bkchan@codeaurora.org>
---
drivers/video/msm/mdss/mdss_rotator.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/msm/mdss/mdss_rotator.c b/drivers/video/msm/mdss/mdss_rotator.c
index f23a05c..f3c40cf 100644
--- a/drivers/video/msm/mdss/mdss_rotator.c
+++ b/drivers/video/msm/mdss/mdss_rotator.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -2059,10 +2059,12 @@ static int mdss_rotator_config_session(struct mdss_rot_mgr *mgr,
return ret;
}
+ mutex_lock(&mgr->lock);
perf = mdss_rotator_find_session(private, config.session_id);
if (!perf) {
pr_err("No session with id=%u could be found\n",
config.session_id);
+ mutex_unlock(&mgr->lock);
return -EINVAL;
}
@@ -2085,6 +2087,7 @@ static int mdss_rotator_config_session(struct mdss_rot_mgr *mgr,
config.output.format);
done:
ATRACE_END(__func__);
+ mutex_unlock(&mgr->lock);
return ret;
}
--
cgit v1.1