Skip to content

Commit b8b4a41

Browse files
richardweinbergerherbertx
authored andcommitted
padata - Register hotcpu notifier after initialization
padata_cpu_callback() takes pinst->lock, to avoid taking an uninitialized lock, register the notifier after it's initialization. Signed-off-by: Richard Weinberger <[email protected]> Acked-by: Steffen Klassert <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 9c823f9 commit b8b4a41

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/padata.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1074,18 +1074,18 @@ struct padata_instance *padata_alloc(struct workqueue_struct *wq,
10741074

10751075
pinst->flags = 0;
10761076

1077-
#ifdef CONFIG_HOTPLUG_CPU
1078-
pinst->cpu_notifier.notifier_call = padata_cpu_callback;
1079-
pinst->cpu_notifier.priority = 0;
1080-
register_hotcpu_notifier(&pinst->cpu_notifier);
1081-
#endif
1082-
10831077
put_online_cpus();
10841078

10851079
BLOCKING_INIT_NOTIFIER_HEAD(&pinst->cpumask_change_notifier);
10861080
kobject_init(&pinst->kobj, &padata_attr_type);
10871081
mutex_init(&pinst->lock);
10881082

1083+
#ifdef CONFIG_HOTPLUG_CPU
1084+
pinst->cpu_notifier.notifier_call = padata_cpu_callback;
1085+
pinst->cpu_notifier.priority = 0;
1086+
register_hotcpu_notifier(&pinst->cpu_notifier);
1087+
#endif
1088+
10891089
return pinst;
10901090

10911091
err_free_masks:

0 commit comments

Comments
 (0)