History

[PATCH] cpu hotplug: fix CPU_UP_CANCEL handling

If a cpu hotplug callback fails on CPU_UP_PREPARE, all callbacks will be called with CPU_UP_CANCELED. A few of these callbacks assume that on CPU_UP_PREPARE a pointer to task has been stored in a percpu array. This assumption is not true if CPU_UP_PREPARE fails and the following calls to kthread_bind() in CPU_UP_CANCELED will cause an addressing exception because of passing a NULL pointer.

Heiko Carstens committed 20 years ago

Commit fc75cdf1 parent 04a34464 files · +8 −0Browse files

Showing the changes to kernel/workqueue.c (1 of 4 files). Show all

Unified · Split

kernel/workqueue.c+2−0
@@ -590,6 +590,8 @@ static int workqueue_cpu_callback(struct notifier_block *nfb, · 589 unmodified lines
590590
591591 case CPU_UP_CANCELED:
592592 list_for_each_entry(wq, &workqueues, list) {
593+ if (!per_cpu_ptr(wq->cpu_wq, hotcpu)->thread)
594+ continue;
593595 /* Unbind so it can run. */
594596 kthread_bind(per_cpu_ptr(wq->cpu_wq, hotcpu)->thread,
595597 any_online_cpu(cpu_online_map));