diff mbox series

drm/i915: check before removing mm notifier

Message ID 20220308171747.25199-1-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: check before removing mm notifier | expand

Commit Message

Nirmoy Das March 8, 2022, 5:17 p.m. UTC
mmu_notifier_register() can get interrupted which will
leave a NULL notifier.mm pointer. Catch that and return
early.

Signed-off-by: Das, Nirmoy <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
index 6d1a71d6404c..d1af9d8721c4 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
@@ -378,6 +378,9 @@  i915_gem_userptr_release(struct drm_i915_gem_object *obj)
 {
 	GEM_WARN_ON(obj->userptr.page_ref);
 
+	if (!obj->userptr.notifier.mm)
+		return;
+
 	mmu_interval_notifier_remove(&obj->userptr.notifier);
 	obj->userptr.notifier.mm = NULL;
 }