drm/i915: Prevent use-after-free in invalidate_range_start callback
authorMichał Winiarski <michal.winiarski@intel.com>
Tue, 3 Feb 2015 14:48:17 +0000 (15:48 +0100)
committerJani Nikula <jani.nikula@intel.com>
Thu, 5 Feb 2015 14:31:30 +0000 (16:31 +0200)
commit460822b0b1a77db859b0320469799fa4dbe4d367
tree3f2e09686dc7e70d82a75c4d475e84f944606ebe
parent1293eaa3ebf92f146f366d9b678a07b8b3200ea1
drm/i915: Prevent use-after-free in invalidate_range_start callback

It's possible for invalidate_range_start mmu notifier callback to race
against userptr object release. If the gem object was released prior to
obtaining the spinlock in invalidate_range_start we're hitting null
pointer dereference.

Testcase: igt/gem_userptr_blits/stress-mm-invalidate-close
Testcase: igt/gem_userptr_blits/stress-mm-invalidate-close-overlap
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
[Jani: added code comment suggested by Chris]
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/i915_gem_userptr.c