Commit c0982b96 authored by Vlastimil Babka's avatar Vlastimil Babka Committed by Greg Kroah-Hartman
Browse files

UPSTREAM: mm/mremap: fix dup_anon_vma() in vma_merge() case 4

In case 4, we are shrinking 'prev' (PPPP in the comment) and expanding
'mid' (NNNN).  So we need to make sure 'mid' clones the anon_vma from
'prev', if it doesn't have any.  After commit 0503ea8f ("mm/mmap:
remove __vma_adjust()") we can fail to do that due to wrong parameters for
dup_anon_vma().  The call is a no-op because res == next, adjust == mid
and mid == next.  Fix it.

Link: https://lkml.kernel.org/r/ad91d62b-37eb-4b73-707a-3c45c9e16256@suse.cz


Fixes: 0503ea8f ("mm/mmap: remove __vma_adjust()")
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
Reviewed-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 4c675996)
[adelva: restore something in 6.3 that was lost in reverts]
Bug: 281094761
Signed-off-by: default avatarAlistair Delva <adelva@google.com>
Change-Id: I74e0635eb204e6efcd78f973b4b3ee7d9698c376
parent 534aabfc
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment