public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/boot: Fail gracefully if SMP MP-table early_memremap fails
@ 2022-08-19 22:44 Russ Dill
  2022-08-20 15:33 ` Borislav Petkov
  0 siblings, 1 reply; 2+ messages in thread
From: Russ Dill @ 2022-08-19 22:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Russ Dill, Tom Lendacky, Ingo Molnar, Thomas Gleixner, Yinghai Lu,
	Dave Hansen, H . Peter Anvin, x86

At least one older motherboard (Micronics W6-LI Pentium Pro) has been
observed to fill in the physptr but not actually populate the mpc when
only one CPU is present. In this specific case, this leads to the size
field being zero which causes early_memremap to fail. This then
causes a NULL pointer exception in smp_read_mpc.

Add a simple return check. Returning -1 here will cause the MP-table to
be ignored and the system to boot in nosmp mode.

Signed-off-by: Russ Dill <Russ.Dill@gmail.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: x86@kernel.org
---
 arch/x86/kernel/mpparse.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index fed721f90116..ca2af4f42cb8 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -438,6 +438,10 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early)
 
 	size = get_mpc_size(mpf->physptr);
 	mpc = early_memremap(mpf->physptr, size);
+	if (!mpc) {
+		pr_err("MPTABLE: mpc early_memremap() failed\n");
+		return -1;
+	}
 
 	/*
 	 * Read the physical hardware table.  Anything here will
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-20 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19 22:44 [PATCH] x86/boot: Fail gracefully if SMP MP-table early_memremap fails Russ Dill
2022-08-20 15:33 ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox