[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-32b40a82e84414499bb4d635cafb9de9e45e6c38@git.kernel.org>
Date: Tue, 28 Mar 2017 00:04:05 -0700
From: tip-bot for Borislav Petkov <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: torvalds@...ux-foundation.org, hpa@...or.com,
linux-kernel@...r.kernel.org, mingo@...nel.org, tglx@...utronix.de,
peterz@...radead.org, linux-edac@...r.kernel.org, bp@...e.de
Subject: [tip:ras/core] x86/mce: Do not register notifiers with invalid prio
Commit-ID: 32b40a82e84414499bb4d635cafb9de9e45e6c38
Gitweb: http://git.kernel.org/tip/32b40a82e84414499bb4d635cafb9de9e45e6c38
Author: Borislav Petkov <bp@...e.de>
AuthorDate: Mon, 27 Mar 2017 11:33:04 +0200
Committer: Ingo Molnar <mingo@...nel.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@...e.de>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-edac <linux-edac@...r.kernel.org>
Link: http://lkml.kernel.org/r/20170327093304.10683-7-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@...nel.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);
}
Powered by blists - more mailing lists