Re: [PATCH mm-hotfixes] mm/rmap: clear vma->anon_vma on error

Jiakai Xu
2026-03-19T01:12:53Z

Tested-by: Jiakai Xu <jiakaiPeanut@gmail.com>

Thanks!

> ---
> mm/rmap.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 6398d7eef393..abe4712a220c 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -457,6 +457,13 @@ static void cleanup_partial_anon_vmas(struct vm_area_struct *vma)
> list_del(&avc->same_vma);
> anon_vma_chain_free(avc);
> }
> +
> + /*
> + * The anon_vma assigned to this VMA is no longer valid, as we were not
> + * able to correctly clone AVC state. Avoid inconsistent anon_vma tree
> + * state by resetting.
> + */
> + vma->anon_vma = NULL;
> }
>
> /**
> --
> 2.53.0