Re: [PATCH v2] sched/topology: Free NUMA masks on topology allocation failure
From: Valentin Schneider
Date: Fri Aug 14 2026 - 11:55:10 EST
On 12/08/26 14:22, Fengyu Wang wrote:
> sched_init_numa() publishes sched_domains_numa_masks before it
> allocates the topology array. When that allocation fails, the early
> return leaves the masks published while sched_domains_numa_levels is
> still zero: nothing dereferences them, but nothing can free them
> either, and the topology they were built for is never installed.
>
> Free the masks on that path, and publish them only once the topology
> array they were built for has been allocated.
>
sched_init_numa() still returns nothing, and an allocation failure in
scheduler topology code is pretty much always paired with a dumpster fire,
but I guess this may help you get further in the booting process of a
borked kernel...
> Fixes: cb83b629bae0 ("sched/numa: Rewrite the CONFIG_NUMA sched domain support")
> Signed-off-by: Fengyu Wang <wangfengyu@xxxxxxxx>
Reviewed-by: Valentin Schneider <vschneid@xxxxxxxxxx>