Re: [PATCH v2 5/5] of: reserved_mem: retain static no-map memory on init failure

From: Marek Szyprowski

Date: Wed Aug 26 2026 - 09:22:20 EST


On 18.08.2026 11:24, Wandun Chen wrote:
> From: Wandun Chen <chenwandun@xxxxxxxxxxx>
>
> Static no-map reserved-memory regions are initialized after paging_init().
> If initialization fails, MEMBLOCK_NOMAP would be cleared, and the memory
> is available to the buddy allocator even though it was excluded from the
> kernel linear mapping.
>
> Clear MEMBLOCK_NOMAP only for dynamically allocated regions, which are
> initialized before paging_init() and can safely be made available to the
> kernel linear mapping.
>
> Sashiko found this issue in [1].
>
> Fixes: 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved memory regions are processed")
> Signed-off-by: Wandun Chen <chenwandun@xxxxxxxxxxx>
Acked-by: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
> Link: https://protect2.fireeye.com/v1/url?k=b169dca9-d0f63c99-b16857e6-000babe403ab-705f8403a3aaee16&q=1&e=a8dd8ad7-74ca-479d-8b2d-d49b0225734b&u=https%3A%2F%2Fsashiko.dev%2F%23%2Fmessage%2F20260814090305.4C8741F00A3D%2540smtp.kernel.org [1]
> ---
> drivers/of/of_reserved_mem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
> index ac5db19dcc93..0090fa86dd10 100644
> --- a/drivers/of/of_reserved_mem.c
> +++ b/drivers/of/of_reserved_mem.c
> @@ -709,7 +709,7 @@ static void __init fdt_init_reserved_mem_node(unsigned long node, const char *un
> pr_info("node %s compatible matching fail\n", rmem->name);
> rmem->name = NULL;
>
> - if (nomap)
> + if (dynamic && nomap)
> memblock_clear_nomap(rmem->base, rmem->size);
>
> if (dynamic || !nomap)

Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland