summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSunil Khatri <sunilkh@codeaurora.org>2017-04-06 18:28:31 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-04-07 05:36:33 -0700
commit1c4ddc4c7a4fcdf9371048ce01a6b0e5d2a2bae9 (patch)
tree8893e2112da097dac60c76593d5d4aaf3c75e5c8 /drivers/gpu
parent6319cf033ba2da8fdbdfcbdd159b20450a871726 (diff)
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. Change-Id: Ic26d3e5b68078c02d15c38080b1a262ea4b1f7fe Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/msm/kgsl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/msm/kgsl.c b/drivers/gpu/msm/kgsl.c
index 1de8e212a703..54f591e4bbad 100644
--- a/drivers/gpu/msm/kgsl.c
+++ b/drivers/gpu/msm/kgsl.c
@@ -1764,9 +1764,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;
}