From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH v2] drm/i915: Fixup userptr mmu notifier registration error handling
Date: Tue, 17 Oct 2017 16:09:08 +0100 [thread overview]
Message-ID: <20171017150908.12840-1-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20171017141422.18463-1-daniel.vetter@ffwll.ch>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
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>
---
drivers/gpu/drm/i915/i915_gem_userptr.c | 10 ++++++----
1 file 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);
}
--
2.9.5
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-10-17 15:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 14:14 [PATCH] drm/i915: Fixup userptr mmu notifier registration error handling Daniel Vetter
2017-10-17 15:09 ` Tvrtko Ursulin [this message]
2017-10-17 15:32 ` [PATCH v2] " Chris Wilson
2017-10-18 9:07 ` Daniel Vetter
2017-10-18 9:39 ` Tvrtko Ursulin
2017-10-17 15:12 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-10-17 16:07 ` ✓ Fi.CI.BAT: success for drm/i915: Fixup userptr mmu notifier registration error handling (rev2) Patchwork
2017-10-18 8:26 ` Tvrtko Ursulin
2017-10-18 2:37 ` ✗ Fi.CI.IGT: warning " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171017150908.12840-1-tvrtko.ursulin@linux.intel.com \
--to=tursulin@ursulin.net \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=dan.carpenter@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox