From: Borislav Petkov Date: Mon, 27 Mar 2017 09:33:04 +0000 (+0200) Subject: x86/mce: Do not register notifiers with invalid prio X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=32b40a82e84414499bb4d635cafb9de9e45e6c38;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-edac Link: http://lkml.kernel.org/r/20170327093304.10683-7-bp@alien8.de Signed-off-by: Ingo Molnar --- 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; 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); }