diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-02-23 01:14:56 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-23 01:41:31 -0500 |
commit | ecda06289f8202d4c6beb235f59ea464f4a91209 (patch) | |
tree | 351d1919e4ea31dc727b6793bab2527461d06ef5 /arch/x86/kernel/mpparse.c | |
parent | 8e6dafd6c741cd4679b4de3c5d9698851e4fa59c (diff) |
x86: check mptable physptr with max_low_pfn on 32bit
Impact: fix early crash on LinuxBIOS systems
Kevin O'Connor reported that Coreboot aka LinuxBIOS tries to put
mptable somewhere very high, well above max_low_pfn (below which
BIOSes generally put the mptable), causing a panic.
The BIOS will probably be changed to be compatible with older
Linus versions, but nevertheless the MP-spec does not forbid
an MP-table in arbitrary system RAM, so make sure it all
works even if the table is in an unexpected place.
Check physptr with max_low_pfn * PAGE_SIZE.
Reported-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Stefan Reinauer <stepan@coresystems.de>
Cc: coreboot@coreboot.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/mpparse.c')
-rw-r--r-- | arch/x86/kernel/mpparse.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 7f4d2586972e..37cb1bda1baf 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -710,13 +710,22 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, | |||
710 | * of physical memory; so that simply reserving | 710 | * of physical memory; so that simply reserving |
711 | * PAGE_SIZE from mpf->physptr yields BUG() | 711 | * PAGE_SIZE from mpf->physptr yields BUG() |
712 | * in reserve_bootmem. | 712 | * in reserve_bootmem. |
713 | * also need to make sure physptr is below than | ||
714 | * max_low_pfn | ||
715 | * we don't need reserve the area above max_low_pfn | ||
713 | */ | 716 | */ |
714 | unsigned long end = max_low_pfn * PAGE_SIZE; | 717 | unsigned long end = max_low_pfn * PAGE_SIZE; |
715 | if (mpf->physptr + size > end) | 718 | |
716 | size = end - mpf->physptr; | 719 | if (mpf->physptr < end) { |
717 | #endif | 720 | if (mpf->physptr + size > end) |
721 | size = end - mpf->physptr; | ||
722 | reserve_bootmem_generic(mpf->physptr, size, | ||
723 | BOOTMEM_DEFAULT); | ||
724 | } | ||
725 | #else | ||
718 | reserve_bootmem_generic(mpf->physptr, size, | 726 | reserve_bootmem_generic(mpf->physptr, size, |
719 | BOOTMEM_DEFAULT); | 727 | BOOTMEM_DEFAULT); |
728 | #endif | ||
720 | } | 729 | } |
721 | 730 | ||
722 | return 1; | 731 | return 1; |