public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>
Cc: dougthompson@xmission.com, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] EDAC, MCE, AMD: Fix code to prevent NULL dereference
Date: Mon, 17 Feb 2014 19:27:29 +0100	[thread overview]
Message-ID: <20140217182729.GE4559@pd.tnic> (raw)
In-Reply-To: <1392659391-2411-1-git-send-email-Aravind.Gopalakrishnan@amd.com>

On Mon, Feb 17, 2014 at 11:49:51AM -0600, Aravind Gopalakrishnan wrote:
> If MCE decoding support does not exist for a particular family/model,
> and if one tries to inject errors using mce_amd_inj module, it leads
> to kernel OOPS. Especially if we inject errors to MC0, MC1, MC2 banks.

Well, we shouldn't even be loading the module on unsupported hw, i.e.,
something like that:

--
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index 30f7309446a6..3ef997bfb89d 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -816,10 +816,10 @@ static int __init mce_amd_init(void)
 	struct cpuinfo_x86 *c = &boot_cpu_data;
 
 	if (c->x86_vendor != X86_VENDOR_AMD)
-		return 0;
+		return -ENODEV;
 
 	if (c->x86 < 0xf || c->x86 > 0x16)
-		return 0;
+		return -ENODEV;
 
 	fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL);
 	if (!fam_ops)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2014-02-17 18:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-17 17:49 [PATCH] EDAC, MCE, AMD: Fix code to prevent NULL dereference Aravind Gopalakrishnan
2014-02-17 18:27 ` Borislav Petkov [this message]
2014-02-17 19:26   ` Aravind Gopalakrishnan
2014-02-17 19:41     ` Borislav Petkov
2014-02-17 22:36       ` Aravind Gopalakrishnan
2014-02-18  0:36         ` Borislav Petkov
2014-02-18  8:46           ` Borislav Petkov
2014-02-18 18:27             ` Aravind Gopalakrishnan
2014-02-20  9:32               ` Borislav Petkov
2014-02-20 16:07                 ` Aravind Gopalakrishnan
2014-02-20 16:13                   ` Borislav Petkov
2014-02-21 14:23                     ` Borislav Petkov
2014-02-21 16:46                       ` Aravind Gopalakrishnan

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=20140217182729.GE4559@pd.tnic \
    --to=bp@alien8.de \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=dougthompson@xmission.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.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