Re: [PATCH v3 2/3] mmap: Fix error paths with dup_anon_vma()

From: Vlastimil Babka
Date: Mon Oct 02 2023 - 03:11:08 EST


On 9/29/23 20:30, Liam R. Howlett wrote:
> When the calling function fails after the dup_anon_vma(), the
> duplication of the anon_vma is not being undone. Add the necessary
> unlink_anon_vma() call to the error paths that are missing them.
>
> This issue showed up during inspection of the error path in vma_merge()
> for an unrelated vma iterator issue.
>
> Users may experience increased memory usage, which may be problematic as
> the failure would likely be caused by a low memory situation.
>
> Fixes: d4af56c5c7c6 ("mm: start tracking VMAs with maple tree")
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: Jann Horn <jannh@xxxxxxxxxx>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>