Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb9375d2 authored by Sunil Khatri's avatar Sunil Khatri
Browse files

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: default avatarSunil Khatri <sunilkh@codeaurora.org>
parent 20ae7a51
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1665,9 +1665,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;
}