* Re: [PATCH 6.6.y] mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()
2026-03-03 10:12 [PATCH 6.6.y] mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node() David Hildenbrand (Arm)
@ 2026-03-03 15:24 ` Liam R. Howlett
2026-03-04 17:40 ` Gregory Price
2026-03-19 14:09 ` Patch "mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()" has been added to the 6.6-stable tree gregkh
2 siblings, 0 replies; 4+ messages in thread
From: Liam R. Howlett @ 2026-03-03 15:24 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: stable, linux-mm, Li Ying, Greg Kroah-Hartman, Andrew Morton,
Matthew Wilcox, Christoph Lameter
* David Hildenbrand (Arm) <david@kernel.org> [260303 05:12]:
> The backport of commit 091c1dd2d4df ("mm/mempolicy: fix migrate_to_node()
> assuming there is at least one VMA in a MM") contains an error:
> migrate_to_node() does not lock the mmap_lock itself, that is handled by
> the caller instead.
>
> So let's drop the wrong mmap_read_unlock(). Fortunately, this path is
> very hard to hit in practice.
>
> Fixes: a13b2b9b0b0b ("mm/mempolicy: fix migrate_to_node() assuming there is at least one VMA in a MM")
> Reported-by: Li Ying <liying3@sungrowpower.com>
> Closes: https://lore.kernel.org/r/aaZgUNxAyKC2IwuG@casper.infradead.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Ouch, yeah. The locking is different.
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
> ---
> mm/mempolicy.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 94c74c594d10..d8007e1c2690 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -1071,10 +1071,8 @@ static long migrate_to_node(struct mm_struct *mm, int source, int dest,
>
> VM_BUG_ON(!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)));
> vma = find_vma(mm, 0);
> - if (unlikely(!vma)) {
> - mmap_read_unlock(mm);
> + if (unlikely(!vma))
> return 0;
> - }
>
> /*
> * This does not migrate the range, but isolates all pages that
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 6.6.y] mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()
2026-03-03 10:12 [PATCH 6.6.y] mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node() David Hildenbrand (Arm)
2026-03-03 15:24 ` Liam R. Howlett
@ 2026-03-04 17:40 ` Gregory Price
2026-03-19 14:09 ` Patch "mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()" has been added to the 6.6-stable tree gregkh
2 siblings, 0 replies; 4+ messages in thread
From: Gregory Price @ 2026-03-04 17:40 UTC (permalink / raw)
To: David Hildenbrand (Arm)
Cc: stable, linux-mm, Li Ying, Greg Kroah-Hartman, Andrew Morton,
Matthew Wilcox, Christoph Lameter, Liam R . Howlett
On Tue, Mar 03, 2026 at 11:12:45AM +0100, David Hildenbrand (Arm) wrote:
> The backport of commit 091c1dd2d4df ("mm/mempolicy: fix migrate_to_node()
> assuming there is at least one VMA in a MM") contains an error:
> migrate_to_node() does not lock the mmap_lock itself, that is handled by
> the caller instead.
>
> So let's drop the wrong mmap_read_unlock(). Fortunately, this path is
> very hard to hit in practice.
>
> Fixes: a13b2b9b0b0b ("mm/mempolicy: fix migrate_to_node() assuming there is at least one VMA in a MM")
> Reported-by: Li Ying <liying3@sungrowpower.com>
> Closes: https://lore.kernel.org/r/aaZgUNxAyKC2IwuG@casper.infradead.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Matthew Wilcox <willy@infradead.org>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Liam R. Howlett <Liam.Howlett@Oracle.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
straight forward, thanks for the quick fix
Reviewed-by: Gregory Price <gourry@gourry.net>
^ permalink raw reply [flat|nested] 4+ messages in thread* Patch "mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()" has been added to the 6.6-stable tree
2026-03-03 10:12 [PATCH 6.6.y] mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node() David Hildenbrand (Arm)
2026-03-03 15:24 ` Liam R. Howlett
2026-03-04 17:40 ` Gregory Price
@ 2026-03-19 14:09 ` gregkh
2 siblings, 0 replies; 4+ messages in thread
From: gregkh @ 2026-03-19 14:09 UTC (permalink / raw)
To: Liam.Howlett, akpm, cl, david, gourry, gregkh, linux-mm, liying3,
willy
Cc: stable-commits
This is a note to let you know that I've just added the patch titled
mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()
to the 6.6-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-mempolicy-fix-wrong-mmap_read_unlock-in-migrate_to_node.patch
and it can be found in the queue-6.6 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 david@kernel.org Thu Mar 19 14:49:55 2026
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: Tue, 3 Mar 2026 11:12:45 +0100
Subject: mm/mempolicy: fix wrong mmap_read_unlock() in migrate_to_node()
To: stable@vger.kernel.org
Cc: linux-mm <linux-mm@kvack.org>, "David Hildenbrand (Arm)" <david@kernel.org>, Li Ying <liying3@sungrowpower.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andrew Morton <akpm@linux-foundation.org>, Matthew Wilcox <willy@infradead.org>, Christoph Lameter <cl@linux.com>, "Liam R . Howlett" <Liam.Howlett@Oracle.com>
Message-ID: <20260303101245.22290-1-david@kernel.org>
From: "David Hildenbrand (Arm)" <david@kernel.org>
The backport of commit 091c1dd2d4df ("mm/mempolicy: fix migrate_to_node()
assuming there is at least one VMA in a MM") contains an error:
migrate_to_node() does not lock the mmap_lock itself, that is handled by
the caller instead.
So let's drop the wrong mmap_read_unlock(). Fortunately, this path is
very hard to hit in practice.
Fixes: a13b2b9b0b0b ("mm/mempolicy: fix migrate_to_node() assuming there is at least one VMA in a MM")
Reported-by: Li Ying <liying3@sungrowpower.com>
Closes: https://lore.kernel.org/r/aaZgUNxAyKC2IwuG@casper.infradead.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/mempolicy.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1071,10 +1071,8 @@ static long migrate_to_node(struct mm_st
VM_BUG_ON(!(flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)));
vma = find_vma(mm, 0);
- if (unlikely(!vma)) {
- mmap_read_unlock(mm);
+ if (unlikely(!vma))
return 0;
- }
/*
* This does not migrate the range, but isolates all pages that
Patches currently in stable-queue which might be from david@kernel.org are
queue-6.6/mm-mempolicy-fix-wrong-mmap_read_unlock-in-migrate_to_node.patch
queue-6.6/mm-tracing-rss_stat-ensure-curr-is-false-from-kthread-context.patch
^ permalink raw reply [flat|nested] 4+ messages in thread