From: <gregkh@linuxfoundation.org>
To: John.Hsu@mediatek.com,Liam.Howlett@oracle.com,akpm@linux-foundation.org,gregkh@linuxfoundation.org,linux-mm@kvack.org
Cc: <stable-commits@vger.kernel.org>
Subject: Patch "mm/mmap: Fix extra maple tree write" has been added to the 6.1-stable tree
Date: Sun, 16 Jul 2023 17:05:15 +0200 [thread overview]
Message-ID: <2023071615-stick-bottle-8a39@gregkh> (raw)
In-Reply-To: <20230706185135.2235532-1-Liam.Howlett@oracle.com>
This is a note to let you know that I've just added the patch titled
mm/mmap: Fix extra maple tree write
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
mm-mmap-fix-extra-maple-tree-write.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From Liam.Howlett@oracle.com Sun Jul 16 17:02:51 2023
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Date: Thu, 6 Jul 2023 14:51:35 -0400
Subject: mm/mmap: Fix extra maple tree write
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>, "Liam R. Howlett" <Liam.Howlett@oracle.com>, John Hsu <John.Hsu@mediatek.com>, stable@vger.kernel.org, linux-mm@kvack.org
Message-ID: <20230706185135.2235532-1-Liam.Howlett@oracle.com>
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
based on commit 0503ea8f5ba73eb3ab13a81c1eefbaf51405385a upstream.
This was inadvertently fixed during the removal of __vma_adjust().
When __vma_adjust() is adjusting next with a negative value (pushing
vma->vm_end lower), there would be two writes to the maple tree. The
first write is unnecessary and uses all allocated nodes in the maple
state. The second write is necessary but will need to allocate nodes
since the first write has used the allocated nodes. This may be a
problem as it may not be safe to allocate at this time, such as a low
memory situation. Fix the issue by avoiding the first write and only
write the adjusted "next" VMA.
Reported-by: John Hsu <John.Hsu@mediatek.com>
Link: https://lore.kernel.org/lkml/9cb8c599b1d7f9c1c300d1a334d5eb70ec4d7357.camel@mediatek.com/
Cc: stable@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/mmap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -767,7 +767,8 @@ int __vma_adjust(struct vm_area_struct *
}
if (end != vma->vm_end) {
if (vma->vm_end > end) {
- if (!insert || (insert->vm_start != end)) {
+ if ((vma->vm_end + adjust_next != end) &&
+ (!insert || (insert->vm_start != end))) {
vma_mas_szero(&mas, end, vma->vm_end);
mas_reset(&mas);
VM_WARN_ON(insert &&
Patches currently in stable-queue which might be from Liam.Howlett@oracle.com are
queue-6.1/mm-mmap-fix-extra-maple-tree-write.patch
queue-6.1/mm-mmap-fix-vm_locked-check-in-do_vmi_align_munmap.patch
next prev parent reply other threads:[~2023-07-16 15:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 18:51 [PATCH stable v6.1] mm/mmap: Fix extra maple tree write Liam R. Howlett
2023-07-07 15:55 ` Greg KH
2023-07-07 16:45 ` Liam R. Howlett
2023-07-12 0:54 ` Liam R. Howlett
2023-07-14 14:44 ` Vlastimil Babka
2023-07-14 15:00 ` Liam R. Howlett
2023-07-16 15:05 ` Greg KH
2023-07-16 15:05 ` gregkh [this message]
2023-07-16 15:08 ` Patch "mm/mmap: Fix extra maple tree write" has been added to the 5.4-stable tree gregkh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023071615-stick-bottle-8a39@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=John.Hsu@mediatek.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=stable-commits@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox