DivestOS/Patches/Linux_CVEs/CVE-2017-9682/3.18/0001.patch
2017-11-07 17:32:46 -05:00

32 lines
1.1 KiB
Diff

From cd821a40b76919b0815a9a7c09d0f6cf1f15a7ee Mon Sep 17 00:00:00 2001
From: Sunil Khatri <sunilkh@codeaurora.org>
Date: Mon, 5 Jun 2017 11:16:57 -0700
Subject: [PATCH] msm: kgsl: Fix the race between context create and destroy
Hold the context lock before updating the context id in
param->drawctxt_id to avoid race condition between context
creation and context destroy.
Bug: 36491445
Change-Id: Ic26d3e5b68078c02d15c38080b1a262ea4b1f7fe
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
---
drivers/gpu/msm/kgsl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c
index 7186ccf6b0cb3..5fce561ae971e 100644
--- a/drivers/gpu/msm/kgsl.c
+++ b/drivers/gpu/msm/kgsl.c
@@ -1668,9 +1668,9 @@ long kgsl_ioctl_drawctxt_create(struct kgsl_device_private *dev_priv,
/* Commit the pointer to the context in context_idr */
write_lock(&device->context_lock);
idr_replace(&device->context_idr, context, context->id);
+ param->drawctxt_id = context->id;
write_unlock(&device->context_lock);
- param->drawctxt_id = context->id;
done:
return result;
}