]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
i915: don't use a vma that didn't match the context VM
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 5 Apr 2026 19:42:25 +0000 (12:42 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 5 Apr 2026 19:42:25 +0000 (12:42 -0700)
In eb_lookup_vma(), the code checks that the context vm matches before
incrementing the i915 vma usage count, but for the non-matching case it
didn't clear the non-matching vma pointer, so it would then mistakenly
be returned, causing potential UaF and refcount issues.

Reported-by: Yassine Mounir <sosohero200@gmail.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

index e7918f896a26fe3dca351fd163a25800d70c17fc..942f4eed817f3c0ed2cfdc37b94e0f6c06d15a0d 100644 (file)
@@ -898,6 +898,8 @@ static struct i915_vma *eb_lookup_vma(struct i915_execbuffer *eb, u32 handle)
                vma = radix_tree_lookup(&eb->gem_context->handles_vma, handle);
                if (likely(vma && vma->vm == vm))
                        vma = i915_vma_tryget(vma);
+               else
+                       vma = NULL;
                rcu_read_unlock();
                if (likely(vma))
                        return vma;