* + mm-mmap-properly-unaccount-memory-on-mas_preallocate-failure.patch added to mm-unstable branch
@ 2022-12-02 20:56 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2022-12-02 20:56 UTC (permalink / raw)
To: mm-commits, Liam.Howlett, apopple, akpm
The patch titled
Subject: mm/mmap: properly unaccount memory on mas_preallocate() failure
has been added to the -mm mm-unstable branch. Its filename is
mm-mmap-properly-unaccount-memory-on-mas_preallocate-failure.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-mmap-properly-unaccount-memory-on-mas_preallocate-failure.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: Alistair Popple <apopple@nvidia.com>
Subject: mm/mmap: properly unaccount memory on mas_preallocate() failure
Date: Fri, 2 Dec 2022 15:53:39 +1100
security_vm_enough_memory_mm() accounts memory via a call to
vm_acct_memory(). Therefore any subsequent failures should unaccount for
this memory prior to returning the error.
Link: https://lkml.kernel.org/r/20221202045339.2999017-1-apopple@nvidia.com
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Fixes: 28c5609fb236 ("mm/mmap: preallocate maple nodes for brk vma expansion")
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/mmap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/mm/mmap.c~mm-mmap-properly-unaccount-memory-on-mas_preallocate-failure
+++ a/mm/mmap.c
@@ -2950,7 +2950,7 @@ static int do_brk_flags(struct ma_state
((vma->vm_flags & ~VM_SOFTDIRTY) == flags)) {
mas_set_range(mas, vma->vm_start, addr + len - 1);
if (mas_preallocate(mas, vma, GFP_KERNEL))
- return -ENOMEM;
+ goto unacct_fail;
vma_adjust_trans_huge(vma, vma->vm_start, addr + len, 0);
if (vma->anon_vma) {
@@ -2972,7 +2972,7 @@ static int do_brk_flags(struct ma_state
/* create a vma struct for an anonymous mapping */
vma = vm_area_alloc(mm);
if (!vma)
- goto vma_alloc_fail;
+ goto unacct_fail;
vma_set_anonymous(vma);
vma->vm_start = addr;
@@ -2997,7 +2997,7 @@ out:
mas_store_fail:
vm_area_free(vma);
-vma_alloc_fail:
+unacct_fail:
vm_unacct_memory(len >> PAGE_SHIFT);
return -ENOMEM;
}
_
Patches currently in -mm which might be from apopple@nvidia.com are
mm-mmap-properly-unaccount-memory-on-mas_preallocate-failure.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-02 20:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-02 20:56 + mm-mmap-properly-unaccount-memory-on-mas_preallocate-failure.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.