]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] cpu hotplug: fix CPU_UP_CANCEL handling
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Sun, 25 Jun 2006 12:49:10 +0000 (05:49 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 25 Jun 2006 17:01:22 +0000 (10:01 -0700)
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.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/sched.c
kernel/softirq.c
kernel/softlockup.c
kernel/workqueue.c

index f8d540b324caf7da51df895f14c91e12f34363c6..f06d059edef5e551746c4f67a79d28970a9726ff 100644 (file)
@@ -4756,6 +4756,8 @@ static int migration_call(struct notifier_block *nfb, unsigned long action,
                break;
 #ifdef CONFIG_HOTPLUG_CPU
        case CPU_UP_CANCELED:
+               if (!cpu_rq(cpu)->migration_thread)
+                       break;
                /* Unbind it from offline cpu so it can run.  Fall thru. */
                kthread_bind(cpu_rq(cpu)->migration_thread,
                             any_online_cpu(cpu_online_map));
index 336f92d64e2ec04bb56d7146a4fc1e1eeb1141f5..9e2f1c6e73d7b341958c74baa8af54169c88c119 100644 (file)
@@ -470,6 +470,8 @@ static int cpu_callback(struct notifier_block *nfb,
                break;
 #ifdef CONFIG_HOTPLUG_CPU
        case CPU_UP_CANCELED:
+               if (!per_cpu(ksoftirqd, hotcpu))
+                       break;
                /* Unbind so it can run.  Fall thru. */
                kthread_bind(per_cpu(ksoftirqd, hotcpu),
                             any_online_cpu(cpu_online_map));
index 2c1be1163edc4647384b829a6bb9e2db5bb41b5a..b5c3b94e01ce7408a9f3d0dae310cff0a6939a36 100644 (file)
@@ -127,6 +127,8 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
                break;
 #ifdef CONFIG_HOTPLUG_CPU
        case CPU_UP_CANCELED:
+               if (!per_cpu(watchdog_task, hotcpu))
+                       break;
                /* Unbind so it can run.  Fall thru. */
                kthread_bind(per_cpu(watchdog_task, hotcpu),
                             any_online_cpu(cpu_online_map));
index f869aff6bc0c6aafaa2b3c5ef350851797276adb..565cf7a1febda94b88582c6e9326d782fb29f96c 100644 (file)
@@ -590,6 +590,8 @@ static int workqueue_cpu_callback(struct notifier_block *nfb,
 
        case CPU_UP_CANCELED:
                list_for_each_entry(wq, &workqueues, list) {
+                       if (!per_cpu_ptr(wq->cpu_wq, hotcpu)->thread)
+                               continue;
                        /* Unbind so it can run. */
                        kthread_bind(per_cpu_ptr(wq->cpu_wq, hotcpu)->thread,
                                     any_online_cpu(cpu_online_map));