aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2017-03-27 05:33:04 -0400
committerIngo Molnar <mingo@kernel.org>2017-03-28 02:55:15 -0400
commit32b40a82e84414499bb4d635cafb9de9e45e6c38 (patch)
tree7007ad416e59103d8f1bcefc5b23d871434ce8b7
parent5de97c9f6d85fd83af76e09e338b18e7adb1ae60 (diff)
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>
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 36082c7fe4a0..a09bb6775c23 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;
157 157
158void mce_register_decode_chain(struct notifier_block *nb) 158void mce_register_decode_chain(struct notifier_block *nb)
159{ 159{
160 atomic_inc(&num_notifiers); 160 if (WARN_ON(nb->priority > MCE_PRIO_LOWEST && nb->priority < MCE_PRIO_EDAC))
161 return;
161 162
162 WARN_ON(nb->priority > MCE_PRIO_LOWEST && nb->priority < MCE_PRIO_EDAC); 163 atomic_inc(&num_notifiers);
163 164
164 atomic_notifier_chain_register(&x86_mce_decoder_chain, nb); 165 atomic_notifier_chain_register(&x86_mce_decoder_chain, nb);
165} 166}