aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_userptr.c
diff options
context:
space:
mode:
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>2017-10-17 16:09:08 +0100
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2017-10-18 09:25:39 +0100
commitcb8d50dfb341e9615c8d203a3e6513dae9ff901d (patch)
tree0c1d9aa4c26c37fed29ce5e98030105b2742c2ce /drivers/gpu/drm/i915/i915_gem_userptr.c
parentdrm/i915: Use a mask when applying WaProgramL3SqcReg1Default (diff)
downloadlinux-dev-cb8d50dfb341e9615c8d203a3e6513dae9ff901d.tar.xz
linux-dev-cb8d50dfb341e9615c8d203a3e6513dae9ff901d.zip
drm/i915: Fixup userptr mmu notifier registration error handling
Avoid dereferencing the error pointer and also avoid returning NULL from i915_mmu_notifier_find since the callers do not expect that. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock") Cc: Dan Carpenter <dan.carpenter@oracle.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20171017150908.12840-1-tvrtko.ursulin@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_userptr.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_userptr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index cdc9be799eee..e26b23171b56 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -221,15 +221,17 @@ i915_mmu_notifier_find(struct i915_mm_struct *mm)
/* Protected by mm_lock */
mm->mn = fetch_and_zero(&mn);
}
- } else {
- /* someone else raced and successfully installed the mmu
- * notifier, we can cancel our own errors */
+ } else if (mm->mn) {
+ /*
+ * Someone else raced and successfully installed the mmu
+ * notifier, we can cancel our own errors.
+ */
err = 0;
}
mutex_unlock(&mm->i915->mm_lock);
up_write(&mm->mm->mmap_sem);
- if (mn) {
+ if (mn && !IS_ERR(mn)) {
destroy_workqueue(mn->wq);
kfree(mn);
}