Re: [PATCH] x86/mm: Tear down the direct map when memory hot add fails

From: Muchun Song

Date: Sun Nov 08 2026 - 22:44:46 EST




> On Nov 8, 2026, at 11:00, Chris Down <chris@xxxxxxxxxxxxxx> wrote:
>
> arch_add_memory() sets up the direct map before calling add_pages().
> If add_pages() fails, the range stays mapped and any page tables
> allocated for it are leaked. A later hot add can reuse the stale
> mapping.
>
> Remove the direct mapping on failure.
>
> Fixes: 45e0b78b0532 ("[PATCH] hot-add-mem x86_64: use CONFIG_MEMORY_HOTPLUG_RESERVE")
> Signed-off-by: Chris Down <chris@xxxxxxxxxxxxxx>

Acked-by: Muchun Song <muchun.song@xxxxxxxxx>

Thanks.