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

David Hildenbrand (Arm)
2026-03-18T13:38:27Z

On 3/18/26 14:03, Lorenzo Stoakes (Oracle) wrote:
> On Wed, Mar 18, 2026 at 01:52:44PM +0100, David Hildenbrand (Arm) wrote:
>>
>> Acked-by: David Hildenbrand (Arm) <david@kernel.org>
>>
>
> Thanks!
>
>> LGTM. I was wondering whether anon_vma_clone() should take care of
>> setting up dst->anon_vma. It looks a bit odd in dup_anon_vma.
>
> Well in the fork case we don't want to set vma->anon_vma, as we use
> vma->anon_vma to denote whether or not we reused another anon_vma. For
> split + remap, we already duplicated it via vm_area_dup() ->
> vm_area_init_from().
>
> But... now we have enum vma_operation threaded through here, we can just do
> that there like:
>
> /* dst is unfaulted, so inherit src's anon_vma. */
> if (operation == VMA_OP_MERGE_UNFAULTED)
> dst->anon_vma = src->anon_vma;
>

Exactly what I had in mind.

--
Cheers,

David