Re: [PATCH] x86/mce: Don't unregister CPU hotplug notifier in error path

From: Boris Ostrovsky
Date: Fri Jun 20 2014 - 22:05:16 EST


On 06/20/2014 05:11 PM, Borislav Petkov wrote:
On Fri, Jun 20, 2014 at 04:43:37PM -0400, Boris Ostrovsky wrote:
We are getting CPU_ONLINE notifier for ASPs during boot:
Bah, that's craptastic. Hmm, ok, let's try this instead:

I'll try it later but this doesn't look sufficient to me: we might not reach this point if subsys_system_register() or zalloc_cpumask_var() fail. We could register the notifier as the first thing in this routine (probably after mce_available() succeeds).


-boris


--
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index bb92f38153b2..9a79c8dbd8e8 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2451,6 +2451,12 @@ static __init int mcheck_init_device(void)
for_each_online_cpu(i) {
err = mce_device_create(i);
if (err) {
+ /*
+ * Register notifier anyway (and do not unreg it) so
+ * that we don't leave undeleted timers, see notifier
+ * callback above.
+ */
+ __register_hotcpu_notifier(&mce_cpu_notifier);
cpu_notifier_register_done();
goto err_device_create;
}
@@ -2471,10 +2477,6 @@ static __init int mcheck_init_device(void)
err_register:
unregister_syscore_ops(&mce_syscore_ops);
- cpu_notifier_register_begin();
- __unregister_hotcpu_notifier(&mce_cpu_notifier);
- cpu_notifier_register_done();
-
err_device_create:
/*
* We didn't keep track of which devices were created above, but


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/