]> Git Repo - linux.git/commitdiff
drm/i915: Fixup userptr mmu notifier registration error handling
authorTvrtko Ursulin <[email protected]>
Tue, 17 Oct 2017 15:09:08 +0000 (16:09 +0100)
committerTvrtko Ursulin <[email protected]>
Wed, 18 Oct 2017 08:25:39 +0000 (09:25 +0100)
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 <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Fixes: 7741b547b6e0 ("drm/i915: Preallocate our mmu notifier workequeu to unbreak cpu hotplug deadlock")
Cc: Dan Carpenter <[email protected]>
Cc: Chris Wilson <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/i915/i915_gem_userptr.c

index cdc9be799eeefcdb5f7b09f7dc44b7b84dbffad2..e26b23171b56f5425f44e9094e7a55a28465b821 100644 (file)
@@ -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);
        }
This page took 0.0596 seconds and 4 git commands to generate.