From: Andi Kleen Date: Tue, 14 Nov 2006 15:57:46 +0000 (+0100) Subject: [PATCH] x86-64: Handle reserve_bootmem_generic beyond end_pfn X-Git-Tag: v2.6.19-rc6~7^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e58a02a8f6a7a1c9ae41f39286bcd3aea0d6f24;p=profile%2Fivi%2Fkernel-x86-ivi.git [PATCH] x86-64: Handle reserve_bootmem_generic beyond end_pfn This can happen on kexec kernels with some configurations, in particularly on Unisys ES7000 systems. Analysis by Amul Shah Cc: Amul Shah Signed-off-by: Andi Kleen --- diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c index 971dc11..f1f977a 100644 --- a/arch/x86_64/mm/init.c +++ b/arch/x86_64/mm/init.c @@ -655,9 +655,22 @@ void free_initrd_mem(unsigned long start, unsigned long end) void __init reserve_bootmem_generic(unsigned long phys, unsigned len) { - /* Should check here against the e820 map to avoid double free */ #ifdef CONFIG_NUMA int nid = phys_to_nid(phys); +#endif + unsigned long pfn = phys >> PAGE_SHIFT; + if (pfn >= end_pfn) { + /* This can happen with kdump kernels when accessing firmware + tables. */ + if (pfn < end_pfn_map) + return; + printk(KERN_ERR "reserve_bootmem: illegal reserve %lx %u\n", + phys, len); + return; + } + + /* Should check here against the e820 map to avoid double free */ +#ifdef CONFIG_NUMA reserve_bootmem_node(NODE_DATA(nid), phys, len); #else reserve_bootmem(phys, len);