diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-01-28 20:41:39 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-01-28 20:41:39 +0300 |
commit | a08ebda97e2a32b8f1de2c8240337f726c2e1ba7 (patch) | |
tree | 3085f8816f4b59960c522f4acf58d8e361adc936 /mm/memblock.c | |
parent | 8a696a29c6905594e4abf78eaafcb62165ac61f1 (diff) | |
parent | 6a9531c3a88096a26cf3ac582f7ec44f94a7dcb2 (diff) | |
download | linux-a08ebda97e2a32b8f1de2c8240337f726c2e1ba7.tar.xz |
Merge tag 'fixes-2024-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock fix from Mike Rapoport:
"Fix crash when reserved memory is not added to memory.
When CONFIG_DEFERRED_STRUCT_PAGE_INIT is enabled, the initialization
of reserved pages may cause access of NODE_DATA() with invalid nid and
crash.
Add a fall back to early_pfn_to_nid() in memmap_init_reserved_pages()
to ensure a valid node id is always passed to init_reserved_page()"
* tag 'fixes-2024-01-28' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
memblock: fix crash when reserved memory is not added to memory
Diffstat (limited to 'mm/memblock.c')
-rw-r--r-- | mm/memblock.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c index abd92869874d..4dcb2ee35eca 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -2176,6 +2176,9 @@ static void __init memmap_init_reserved_pages(void) start = region->base; end = start + region->size; + if (nid == NUMA_NO_NODE || nid >= MAX_NUMNODES) + nid = early_pfn_to_nid(PFN_DOWN(start)); + reserve_bootmem_region(start, end, nid); } } |