All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-mremap-fix-dup_anon_vma-in-vma_merge-case-4.patch added to mm-unstable branch
@ 2023-02-23 20:06 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2023-02-23 20:06 UTC (permalink / raw)
  To: mm-commits, Liam.Howlett, vbabka, akpm


The patch titled
     Subject: mm/mremap: fix dup_anon_vma() in vma_merge() case 4
has been added to the -mm mm-unstable branch.  Its filename is
     mm-mremap-fix-dup_anon_vma-in-vma_merge-case-4.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mremap-fix-dup_anon_vma-in-vma_merge-case-4.patch

This patch will later appear in the mm-unstable branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Vlastimil Babka <vbabka@suse.cz>
Subject: 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 |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/mmap.c~mm-mremap-fix-dup_anon_vma-in-vma_merge-case-4
+++ a/mm/mmap.c
@@ -973,7 +973,7 @@ struct vm_area_struct *vma_merge(struct
 			vma_end = addr;
 			adjust = mid;
 			adj_next = -(vma->vm_end - addr);
-			err = dup_anon_vma(res, adjust);
+			err = dup_anon_vma(adjust, prev);
 		} else {
 			vma = next;			/* case 3 */
 			vma_start = addr;
_

Patches currently in -mm which might be from vbabka@suse.cz are

mm-mremap-fix-dup_anon_vma-in-vma_merge-case-4.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-23 20:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-23 20:06 + mm-mremap-fix-dup_anon_vma-in-vma_merge-case-4.patch added to mm-unstable branch Andrew Morton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.