public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86, amd, mce: Prevent potential cpu-online oops
@ 2013-04-04 15:52 Daniel J Blueman
  2013-04-04 16:04 ` Luck, Tony
  2013-04-04 16:13 ` Borislav Petkov
  0 siblings, 2 replies; 11+ messages in thread
From: Daniel J Blueman @ 2013-04-04 15:52 UTC (permalink / raw)
  To: Tony Luck, Borislav Petkov, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, linux-edac, linux-kernel
  Cc: Steffen Persvold, Daniel J Blueman

On platforms where all Northbridges may not be visible (due to routing, eg on
NumaConnect systems), prevent oopsing due to stale pointer access when
offlining cores.

Signed-off-by: Steffen Persvold <sp@numascale.com>
Signed-off-by: Daniel J Blueman <daniel@numascale-asia.com>

---
 arch/x86/kernel/cpu/mcheck/mce_amd.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 1ac581f..53a58c2 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -578,8 +578,11 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
 	if (shared_bank[bank]) {
 		nb = node_to_amd_nb(amd_get_nb_id(cpu));
 
+		if (WARN_ON_ONCE(!nb))
+			goto out;
+
 		/* threshold descriptor already initialized on this node? */
-		if (nb && nb->bank4) {
+		if (nb->bank4) {
 			/* yes, use it */
 			b = nb->bank4;
 			err = kobject_add(b->kobj, &dev->kobj, name);
@@ -613,10 +616,8 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
 		atomic_set(&b->cpus, 1);
 
 		/* nb is already initialized, see above */
-		if (nb) {
-			WARN_ON(nb->bank4);
-			nb->bank4 = b;
-		}
+		WARN_ON(nb->bank4);
+		nb->bank4 = b;
 	}
 
 	err = allocate_threshold_blocks(cpu, bank, 0,
-- 
1.7.4.1


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

end of thread, other threads:[~2013-04-09 11:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-04 15:52 [PATCH] x86, amd, mce: Prevent potential cpu-online oops Daniel J Blueman
2013-04-04 16:04 ` Luck, Tony
2013-04-04 16:13 ` Borislav Petkov
2013-04-04 18:05   ` Steffen Persvold
2013-04-04 19:07     ` Borislav Petkov
2013-04-04 20:01       ` Steffen Persvold
2013-04-09  9:25       ` Steffen Persvold
2013-04-09  9:38         ` Borislav Petkov
2013-04-09  9:45           ` Steffen Persvold
2013-04-09 10:24             ` Borislav Petkov
2013-04-09 11:34               ` Steffen Persvold

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