Skip to content
Commit 42c4e4b2 authored by Lorenzo Stoakes's avatar Lorenzo Stoakes Committed by Andrew Morton
Browse files

mm: correctly reference merged VMA

On second merge attempt on mmap() we incorrectly discard the possibly
merged VMA, resulting in a possible use-after-free (and most certainly a
reference to the wrong VMA) in this instance in the subsequent
__mmap_complete() invocation.

Correct this mistake by reassigning vma correctly if a merge succeeds in
this case.

Link: https://lkml.kernel.org/r/20241206215229.244413-1-lorenzo.stoakes@oracle.com


Fixes: 5ac87a88 ("mm: defer second attempt at merge on mmap()")
Signed-off-by: default avatarLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Suggested-by: default avatarJann Horn <jannh@google.com>
Reported-by: default avatar <syzbot+91cf8da9401355f946c3@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/all/67536a25.050a0220.a30f1.0149.GAE@google.com/


Reviewed-by: default avatarLiam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: default avatarVlastimil Babka <vbabka@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f5d09de9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment