The patch titled check return value of cpu_callback has been added to the -mm tree. Its filename is check-return-value-of-cpu_callback.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: check return value of cpu_callback From: Akinobu Mita <mita@xxxxxxxxxxxxxxxx> Spawing ksoftirqd, migration, or watchdog, and calling init_timers_cpu() may fail with small memory. If it happens in initcalls, kernel NULL pointer dereference happens later. This patch makes crash happen immediately in such cases. It seems a bit better than getting kernel NULL pointer dereference later. Cc: Ingo Molnar <mingo@xxxxxxx> Signed-off-by: Akinobu Mita <mita@xxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- kernel/sched.c | 4 +++- kernel/softirq.c | 4 +++- kernel/softlockup.c | 3 ++- kernel/timer.c | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff -puN kernel/sched.c~check-return-value-of-cpu_callback kernel/sched.c --- a/kernel/sched.c~check-return-value-of-cpu_callback +++ a/kernel/sched.c @@ -5237,9 +5237,11 @@ static struct notifier_block __cpuinitda int __init migration_init(void) { void *cpu = (void *)(long)smp_processor_id(); + int err; /* Start one for the boot CPU: */ - migration_call(&migration_notifier, CPU_UP_PREPARE, cpu); + err = migration_call(&migration_notifier, CPU_UP_PREPARE, cpu); + BUG_ON(err == NOTIFY_BAD); migration_call(&migration_notifier, CPU_ONLINE, cpu); register_cpu_notifier(&migration_notifier); diff -puN kernel/softirq.c~check-return-value-of-cpu_callback kernel/softirq.c --- a/kernel/softirq.c~check-return-value-of-cpu_callback +++ a/kernel/softirq.c @@ -612,7 +612,9 @@ static struct notifier_block __cpuinitda __init int spawn_ksoftirqd(void) { void *cpu = (void *)(long)smp_processor_id(); - cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); + int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); + + BUG_ON(err == NOTIFY_BAD); cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); return 0; diff -puN kernel/softlockup.c~check-return-value-of-cpu_callback kernel/softlockup.c --- a/kernel/softlockup.c~check-return-value-of-cpu_callback +++ a/kernel/softlockup.c @@ -149,8 +149,9 @@ static struct notifier_block __cpuinitda __init void spawn_softlockup_task(void) { void *cpu = (void *)(long)smp_processor_id(); + int err = cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); - cpu_callback(&cpu_nfb, CPU_UP_PREPARE, cpu); + BUG_ON(err == NOTIFY_BAD); cpu_callback(&cpu_nfb, CPU_ONLINE, cpu); register_cpu_notifier(&cpu_nfb); diff -puN kernel/timer.c~check-return-value-of-cpu_callback kernel/timer.c --- a/kernel/timer.c~check-return-value-of-cpu_callback +++ a/kernel/timer.c @@ -1688,8 +1688,10 @@ static struct notifier_block __cpuinitda void __init init_timers(void) { - timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE, + int err = timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE, (void *)(long)smp_processor_id()); + + BUG_ON(err == NOTIFY_BAD); register_cpu_notifier(&timers_nb); open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL); } _ Patches currently in -mm which might be from mita@xxxxxxxxxxxxxxxx are check-return-value-of-cpu_callback.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html