+ mm-remove-the-vma-linked-list-fix.patch added to mm-unstable branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm/mmap: fix potential leak on do_mas_align_munmap()
has been added to the -mm mm-unstable branch.  Its filename is
     mm-remove-the-vma-linked-list-fix.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-remove-the-vma-linked-list-fix.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: Liam Howlett <liam.howlett@xxxxxxxxxx>
Subject: mm/mmap: fix potential leak on do_mas_align_munmap()
Date: Fri, 13 May 2022 14:15:53 +0000

There is a leak when the system is low on resources and fails to allocate
enough memory to complete the munmap task.  Fix this by adding the
necessary free operations in the unwinding.

Link: https://lkml.kernel.org/r/20220513141548.2019143-1-Liam.Howlett@xxxxxxxxxx
Fixes: a760774e7b7b (mm: start tracking VMAs with maple tree)
Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
Reported-by: Qian Cai <quic_qiancai@xxxxxxxxxxx>
Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/mmap.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/mm/mmap.c~mm-remove-the-vma-linked-list-fix
+++ a/mm/mmap.c
@@ -2394,7 +2394,7 @@ do_mas_align_munmap(struct ma_state *mas
 		return -ENOMEM;
 
 	if (mas_preallocate(&mas_detach, vma, GFP_KERNEL))
-		return -ENOMEM;
+		goto detach_alloc_fail;
 
 	mas->last = end - 1;
 	/*
@@ -2533,6 +2533,8 @@ do_mas_align_munmap(struct ma_state *mas
 map_count_exceeded:
 split_failed:
 userfaultfd_error:
+	mas_destroy(&mas_detach);
+detach_alloc_fail:
 	mas_destroy(mas);
 	return error;
 }
_

Patches currently in -mm which might be from liam.howlett@xxxxxxxxxx are

maple-tree-add-new-data-structure-fix.patch
lib-test_maple_tree-add-testing-for-maple-tree-fix.patch
mm-start-tracking-vmas-with-maple-tree-fix-2.patch
mm-remove-the-vma-linked-list-fix.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux