* [PATCH] mm/rmap: synchronize lock and unlock target in anon_vma_clone
@ 2026-08-14 6:30 Eric Kim
2026-08-14 6:52 ` Lorenzo Stoakes (ARM)
0 siblings, 1 reply; 2+ messages in thread
From: Eric Kim @ 2026-08-14 6:30 UTC (permalink / raw)
To: akpm
Cc: david, ljs, riel, liam, vbabka, harry, jannh, lance.yang,
linux-mm, linux-kernel, Eric Kim
Currently, in anon_vma_clone(), src vma's anon_vma is assigned to
active_anon_vma and is used when unlocking anon_vma after linking new
AVCs. However, the anon_vma is locked using src->anon_vma, instead of
active_anon_vma, making the lock and unlock target inconsistent.
Use active_anon_vma for both locking and unlocking.
Signed-off-by: Eric Kim <seohyun.kim@outlook.kr>
---
mm/rmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/rmap.c b/mm/rmap.c
index 1c77d5dc06e9..f3fadfb69c7f 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -350,7 +350,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src,
* Now link the anon_vma's back to the newly inserted AVCs.
* Note that all anon_vma's share the same root.
*/
- anon_vma_lock_write(src->anon_vma);
+ anon_vma_lock_write(active_anon_vma);
list_for_each_entry_reverse(avc, &dst->anon_vma_chain, same_vma) {
struct anon_vma *anon_vma = avc->anon_vma;
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/rmap: synchronize lock and unlock target in anon_vma_clone
2026-08-14 6:30 [PATCH] mm/rmap: synchronize lock and unlock target in anon_vma_clone Eric Kim
@ 2026-08-14 6:52 ` Lorenzo Stoakes (ARM)
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-08-14 6:52 UTC (permalink / raw)
To: Eric Kim
Cc: akpm, david, riel, liam, vbabka, harry, jannh, lance.yang,
linux-mm, linux-kernel
On Fri, Aug 14, 2026 at 03:30:51PM +0900, Eric Kim wrote:
> Currently, in anon_vma_clone(), src vma's anon_vma is assigned to
> active_anon_vma and is used when unlocking anon_vma after linking new
> AVCs. However, the anon_vma is locked using src->anon_vma, instead of
> active_anon_vma, making the lock and unlock target inconsistent.
IOW, I added active_anon_vma as an alias to src->anon_vma but didn't use it
consistently in the function :)
>
> Use active_anon_vma for both locking and unlocking.
>
> Signed-off-by: Eric Kim <seohyun.kim@outlook.kr>
LGTM, so:
Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> ---
> mm/rmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 1c77d5dc06e9..f3fadfb69c7f 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -350,7 +350,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src,
> * Now link the anon_vma's back to the newly inserted AVCs.
> * Note that all anon_vma's share the same root.
> */
> - anon_vma_lock_write(src->anon_vma);
> + anon_vma_lock_write(active_anon_vma);
> list_for_each_entry_reverse(avc, &dst->anon_vma_chain, same_vma) {
> struct anon_vma *anon_vma = avc->anon_vma;
>
> --
> 2.55.0
>
--
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-14 6:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14 6:30 [PATCH] mm/rmap: synchronize lock and unlock target in anon_vma_clone Eric Kim
2026-08-14 6:52 ` Lorenzo Stoakes (ARM)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox