]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/mremap: fix dup_anon_vma() in vma_merge() case 4 syz_test
authorVlastimil Babka <vbabka@suse.cz>
Tue, 28 Feb 2023 01:00:14 +0000 (17:00 -0800)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 9 Mar 2023 01:38:07 +0000 (20:38 -0500)
commit6d4d1d3748d9de52c793cd4c79560e202eae4dca
treeafeec9d6f7871be995b4e4ff762d3f87ced1720b
parent0988a0ea791999ebbf95693f2676381825b05033
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 0503ea8f5ba7 ("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: 0503ea8f5ba7 ("mm/mmap: remove __vma_adjust()")
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mmap.c