linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Markus Trippelsdorf <markus@trippelsdorf.de>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [patch 2/2] x86/mce/AMD: Make the init code more robust
Date: Tue, 27 Dec 2016 08:06:47 +0100	[thread overview]
Message-ID: <20161227070646.GA8366@nazgul.tnic> (raw)
In-Reply-To: <20161226220019.772709435@linutronix.de>

On Mon, Dec 26, 2016 at 10:58:20PM +0100, Thomas Gleixner wrote:
> If mce_device_init() fails then the mce device pointer is NULL and the AMD
> mce code happily dereferences it.
> 
> Add a sanity check.
> 
> Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
> Reported-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
>  arch/x86/kernel/cpu/mcheck/mce_amd.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> @@ -1182,6 +1182,9 @@ static int threshold_create_bank(unsigne
>  	const char *name = get_name(bank, NULL);
>  	int err = 0;
>  
> +	if (!dev)
> +		return -ENODEV;
> +
>  	if (is_shared_bank(bank)) {
>  		nb = node_to_amd_nb(amd_get_nb_id(cpu));

Acked-by: Borislav Petkov <bp@suse.de>

>From looking at that code, though, it could use some more involved
straightening later.

/me puts it on TODO list.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

      reply	other threads:[~2016-12-27  7:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-26 21:58 [patch 0/2] smp/hotplug: Fix last minute wreckage Thomas Gleixner
2016-12-26 21:58 ` [patch 1/2] smp/hotplug: Undo tglxs brainfart Thomas Gleixner
2016-12-26 21:58 ` [patch 2/2] x86/mce/AMD: Make the init code more robust Thomas Gleixner
2016-12-27  7:06   ` Borislav Petkov [this message]

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=20161227070646.GA8366@nazgul.tnic \
    --to=bp@alien8.de \
    --cc=boris.ostrovsky@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markus@trippelsdorf.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).