Skip to content
Commit e791a345 authored by Yajun Deng's avatar Yajun Deng Committed by Greg Kroah-Hartman
Browse files

memblock: fix crash when reserved memory is not added to memory

[ Upstream commit 6a9531c3 ]

After commit 61167ad5 ("mm: pass nid to reserve_bootmem_region()")
nid of a reserved region is used by init_reserved_page() (with
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y) to access node strucure.
In many cases the nid of the reserved memory is not set and this causes
a crash.

When the nid of a reserved region is not set, fall back to
early_pfn_to_nid(), so that nid of the first_online_node will be passed
to init_reserved_page().

Fixes: 61167ad5

 ("mm: pass nid to reserve_bootmem_region()")
Signed-off-by: default avatarYajun Deng <yajun.deng@linux.dev>
Link: https://lore.kernel.org/r/20240118061853.2652295-1-yajun.deng@linux.dev


[rppt: massaged the commit message]
Signed-off-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0b2e0fea
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment