[Intel-gfx] [PATCH] drm/i915: check before removing mm notifier

Das, Nirmoy nirmoy.das at intel.com
Tue Mar 8 17:17:47 UTC 2022


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 at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 3 +++
 1 file changed, 3 insertions(+)

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;
 }
-- 
2.34.1



More information about the Intel-gfx mailing list