[Intel-gfx] [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling

Daniel Vetter daniel.vetter at ffwll.ch
Tue Oct 17 14:14:22 UTC 2017


One of the original patches got this right, but then in an attempt to
make the error handling more correct it got worse. Try again.

The problem here is that we clear err to 0 when mm->mn != NULL, which
will then leak the workqueue

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock")
Cc: Dan Carpenter <dan.carpenter at oracle.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 drivers/gpu/drm/i915/i915_gem_userptr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 4d712a4db63b..d3df780ee581 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -209,8 +209,10 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
 		return mn;
 
 	mn = i915_mmu_notifier_create(mm->mm);
-	if (IS_ERR(mn))
+	if (IS_ERR(mn)) {
 		err = PTR_ERR(mn);
+		mn = NULL;
+	}
 
 	down_write(&mm->mm->mmap_sem);
 	mutex_lock(&mm->i915->mm_lock);
-- 
2.14.1



More information about the Intel-gfx mailing list