public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Borislav Petkov <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: torvalds@linux-foundation.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org, mingo@kernel.org,
	tglx@linutronix.de, peterz@infradead.org,
	linux-edac@vger.kernel.org, bp@suse.de
Subject: [tip:ras/core] x86/mce: Do not register notifiers with invalid prio
Date: Tue, 28 Mar 2017 00:04:05 -0700	[thread overview]
Message-ID: <tip-32b40a82e84414499bb4d635cafb9de9e45e6c38@git.kernel.org> (raw)
In-Reply-To: <20170327093304.10683-7-bp@alien8.de>

Commit-ID:  32b40a82e84414499bb4d635cafb9de9e45e6c38
Gitweb:     http://git.kernel.org/tip/32b40a82e84414499bb4d635cafb9de9e45e6c38
Author:     Borislav Petkov <bp@suse.de>
AuthorDate: Mon, 27 Mar 2017 11:33:04 +0200
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 28 Mar 2017 08:55:15 +0200

x86/mce: Do not register notifiers with invalid prio

This is just a defensive precaution: do not register notifiers with a
priority which would disrupt the error handling in the notifiers with
prio higher than MCE_PRIO_EDAC.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/20170327093304.10683-7-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 36082c7..a09bb67 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -157,9 +157,10 @@ static atomic_t num_notifiers;
 
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	atomic_inc(&num_notifiers);
+	if (WARN_ON(nb->priority > MCE_PRIO_LOWEST && nb->priority < MCE_PRIO_EDAC))
+		return;
 
-	WARN_ON(nb->priority > MCE_PRIO_LOWEST && nb->priority < MCE_PRIO_EDAC);
+	atomic_inc(&num_notifiers);
 
 	atomic_notifier_chain_register(&x86_mce_decoder_chain, nb);
 }

      reply	other threads:[~2017-03-28  7:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  9:32 [PATCH 0/6] x86/RAS: Correctable Errors Collector Borislav Petkov
2017-03-27  9:32 ` [PATCH 1/6] x86/mce: Don't print MCEs when mcelog is active Borislav Petkov
2017-03-28  7:01   ` [tip:ras/core] " tip-bot for Andi Kleen
2017-03-27  9:33 ` [PATCH 2/6] x86/MCE: Rename mce_log()'s argument Borislav Petkov
2017-03-28  7:01   ` [tip:ras/core] x86/mce: " tip-bot for Borislav Petkov
2017-03-27  9:33 ` [PATCH 3/6] x86/MCE: Rename mce_log to mce_log_buffer Borislav Petkov
2017-03-28  7:02   ` [tip:ras/core] x86/mce: " tip-bot for Borislav Petkov
2017-03-27  9:33 ` [PATCH 4/6] RAS: Add a Corrected Errors Collector Borislav Petkov
2017-03-28  7:02   ` [tip:ras/core] " tip-bot for Borislav Petkov
2017-03-27  9:33 ` [PATCH 5/6] x86/mce: Deprecate /dev/mcelog Borislav Petkov
2017-03-28  7:03   ` [tip:ras/core] x86/mce: Factor out and deprecate the /dev/mcelog driver tip-bot for Tony Luck
2017-03-27  9:33 ` [PATCH 6/6] x86/mce: Do not register notifiers with invalid prio Borislav Petkov
2017-03-28  7:04   ` tip-bot for 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=tip-32b40a82e84414499bb4d635cafb9de9e45e6c38@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --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