mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel J Blueman <daniel@numascale-asia.com>
To: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Steffen Persvold <sp@numascale.com>,
	Daniel J Blueman <daniel@numascale-asia.com>
Subject: [PATCH] x86, amd, mce: Prevent potential cpu-online oops
Date: Thu,  4 Apr 2013 23:52:00 +0800	[thread overview]
Message-ID: <1365090720-12652-1-git-send-email-daniel@numascale-asia.com> (raw)

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


             reply	other threads:[~2013-04-04 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 15:52 Daniel J Blueman [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365090720-12652-1-git-send-email-daniel@numascale-asia.com \
    --to=daniel@numascale-asia.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=sp@numascale.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®