Re: [PATCH] mm/fake-numa: fix leak of the distance table copy on errors

From: David Hildenbrand (Arm)

Date: Wed Dec 02 2026 - 11:54:20 EST


On 12/2/26 17:46, Mike Rapoport wrote:
> From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>
>
> numa_emulation() copies the physical distance table before calling
> fix_pxm_node_maps(), but if fix_pxm_node_maps() fails, the copy is never
> freed.
>
> This only happens with numa=fake= setups that fix_pxm_node_maps() already
> warns about, and leaks a single page on systems with up to 64 nodes.
>
> Free the copy at no_emu. memblock_free() ignores NULL, so this is safe for
> the errors that happen before the table is copied.
>
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Closes: https://sashiko.dev/bug/linux-96a473a0-2815-4091-910e-970513fa6467
> Fixes: 63db8170bf34 ("mm/fake-numa: allow later numa node hotplug")
> ---

Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David