Skip to content

Commit 5401b9a

Browse files
committed
i915: don't use a vma that didn't match the context VM
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>
1 parent eb3765a commit 5401b9a

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,8 @@ static struct i915_vma *eb_lookup_vma(struct i915_execbuffer *eb, u32 handle)
898898
vma = radix_tree_lookup(&eb->gem_context->handles_vma, handle);
899899
if (likely(vma && vma->vm == vm))
900900
vma = i915_vma_tryget(vma);
901+
else
902+
vma = NULL;
901903
rcu_read_unlock();
902904
if (likely(vma))
903905
return vma;

0 commit comments

Comments
 (0)