Skip to content

Commit 4c67599

Browse files
tehcasterakpm00
authored andcommitted
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 0503ea8 ("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/[email protected] Fixes: 0503ea8 ("mm/mmap: remove __vma_adjust()") Signed-off-by: Vlastimil Babka <[email protected]> Reviewed-by: Liam R. Howlett <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1ec35ea commit 4c67599

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,7 @@ struct vm_area_struct *vma_merge(struct vma_iterator *vmi, struct mm_struct *mm,
973973
vma_end = addr;
974974
adjust = mid;
975975
adj_next = -(vma->vm_end - addr);
976-
err = dup_anon_vma(res, adjust);
976+
err = dup_anon_vma(adjust, prev);
977977
} else {
978978
vma = next; /* case 3 */
979979
vma_start = addr;

0 commit comments

Comments
 (0)