mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 03:35:32 -04:00
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>
This commit is contained in:
@@ -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);
|
vma = radix_tree_lookup(&eb->gem_context->handles_vma, handle);
|
||||||
if (likely(vma && vma->vm == vm))
|
if (likely(vma && vma->vm == vm))
|
||||||
vma = i915_vma_tryget(vma);
|
vma = i915_vma_tryget(vma);
|
||||||
|
else
|
||||||
|
vma = NULL;
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
if (likely(vma))
|
if (likely(vma))
|
||||||
return vma;
|
return vma;
|
||||||
|
|||||||
Reference in New Issue
Block a user