padata - Register hotcpu notifier after initialization
authorRichard Weinberger <richard@nod.at>
Fri, 23 Aug 2013 11:12:33 +0000 (13:12 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 29 Aug 2013 04:37:59 +0000 (14:37 +1000)
padata_cpu_callback() takes pinst->lock, to avoid taking
an uninitialized lock, register the notifier after it's
initialization.

Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
kernel/padata.c

index 2f0037a862899fb280cc8811038a211b3bf8987c..07af2c95dcfeea37f855db214e8e3405274bddb6 100644 (file)
@@ -1074,18 +1074,18 @@ struct padata_instance *padata_alloc(struct workqueue_struct *wq,
 
        pinst->flags = 0;
 
-#ifdef CONFIG_HOTPLUG_CPU
-       pinst->cpu_notifier.notifier_call = padata_cpu_callback;
-       pinst->cpu_notifier.priority = 0;
-       register_hotcpu_notifier(&pinst->cpu_notifier);
-#endif
-
        put_online_cpus();
 
        BLOCKING_INIT_NOTIFIER_HEAD(&pinst->cpumask_change_notifier);
        kobject_init(&pinst->kobj, &padata_attr_type);
        mutex_init(&pinst->lock);
 
+#ifdef CONFIG_HOTPLUG_CPU
+       pinst->cpu_notifier.notifier_call = padata_cpu_callback;
+       pinst->cpu_notifier.priority = 0;
+       register_hotcpu_notifier(&pinst->cpu_notifier);
+#endif
+
        return pinst;
 
 err_free_masks: