drm/i915: Hold mutex across i915_gem_release
authorChris Wilson <chris@chris-wilson.co.uk>
Wed, 4 Dec 2013 14:52:06 +0000 (14:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jan 2014 20:25:10 +0000 (12:25 -0800)
commit5ba9e0cd9ef7dcd08ac047787724c8f5ea882074
tree509ea44014a26054c3dda2b44bc959234a0a0249
parent2bdfed0205227201fcb442ee4bea4ba20f34526a
drm/i915: Hold mutex across i915_gem_release

commit 0d1430a3f4b7cfd8779b78740a4182321f3ca7f3 upstream.

Inorder to serialise the closing of the file descriptor and its
subsequent release of client requests with i915_gem_free_request(), we
need to hold the struct_mutex in i915_gem_release(). Failing to do so
has the potential to trigger an OOPS, later with a use-after-free.

Testcase: igt/gem_close_race
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70874
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71029
Reported-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_gem_context.c