Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1609612 > unrolled thread

[PATCH 6/6] x86/mce: Do not register notifiers with invalid prio

Started byBorislav Petkov <bp@alien8.de>
First post2017-03-27 11:40 +0200
Last post2017-03-28 09:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 6/6] x86/mce: Do not register notifiers with invalid prio Borislav Petkov <bp@alien8.de> - 2017-03-27 11:40 +0200
    [tip:ras/core] x86/mce: Do not register notifiers with invalid prio tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-03-28 09:10 +0200

#1609612 — [PATCH 6/6] x86/mce: Do not register notifiers with invalid prio

FromBorislav Petkov <bp@alien8.de>
Date2017-03-27 11:40 +0200
Subject[PATCH 6/6] x86/mce: Do not register notifiers with invalid prio
Message-ID<tpzi2-5Ua-19@gated-at.bofh.it>
From: Borislav Petkov <bp@suse.de>

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>
---
 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 8e119156429b..4b57b8336ecd 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);
 }
-- 
2.11.0

[toc] | [next] | [standalone]


#1610373 — [tip:ras/core] x86/mce: Do not register notifiers with invalid prio

Fromtip-bot for Borislav Petkov <tipbot@zytor.com>
Date2017-03-28 09:10 +0200
Subject[tip:ras/core] x86/mce: Do not register notifiers with invalid prio
Message-ID<tpTqq-41Y-15@gated-at.bofh.it>
In reply to#1609612
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);
 }

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web