<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Rodrigo, <br>
    </p>
    <div class="moz-cite-prefix">On 2/19/2024 9:12 PM, Rodrigo Vivi
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:ZdO2IYev7Amcbtt1@intel.com">
      <pre class="moz-quote-pre" wrap="">On Mon, Feb 19, 2024 at 01:50:47PM +0100, Nirmoy Das wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">Error in mmu_interval_notifier_insert() can leave a NULL
notifier.mm pointer. Catch that and return early.

Cc: Andi Shyti <a class="moz-txt-link-rfc2396E" href="mailto:andi.shyti@linux.intel.com"><andi.shyti@linux.intel.com></a>
Cc: Shawn Lee <a class="moz-txt-link-rfc2396E" href="mailto:shawn.c.lee@intel.com"><shawn.c.lee@intel.com></a>
Signed-off-by: Nirmoy Das <a class="moz-txt-link-rfc2396E" href="mailto:nirmoy.das@intel.com"><nirmoy.das@intel.com></a>
---
 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 0e21ce9d3e5a..61abfb505766 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_userptr.c
@@ -349,6 +349,9 @@ i915_gem_userptr_release(struct drm_i915_gem_object *obj)
 {
        GEM_WARN_ON(obj->userptr.page_ref);
 
+       if (!obj->userptr.notifier.mm)
+               return;
+
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
hmmm... right, it looks that we need this protection. But...

I mean, feel free to use
Reviewed-by: Rodrigo Vivi <a class="moz-txt-link-rfc2396E" href="mailto:rodrigo.vivi@intel.com"><rodrigo.vivi@intel.com></a>

for this patch,

but I believe that if this mmu insert failed we might have other
deeper problems like when checking i915_gem_object_is_userptr() ?

No?!
</pre>
    </blockquote>
    <p>We are returning an error if mmu insert fails while creating a
      userptr object  so the obj struct is only available to obj cleanup
      methods.</p>
    <pre class="moz-quote-pre" wrap="">As far as I see, i915_gem_object_is_userptr() should not happen on such obj struct.

Thanks,
Nirmoy </pre>
    <p></p>
    <span style="white-space: pre-wrap">
</span>
    <blockquote type="cite" cite="mid:ZdO2IYev7Amcbtt1@intel.com">
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">   mmu_interval_notifier_remove(&obj->userptr.notifier);
        obj->userptr.notifier.mm = NULL;
 }
-- 
2.42.0

</pre>
      </blockquote>
    </blockquote>
  </body>
</html>