From: KAMEZAWA Hiroyuki Date: Fri, 19 Oct 2007 06:40:47 +0000 (-0700) Subject: CPU HOTPLUG: avoid hotadd when proper possible_map isn't specified X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=73e753a50dcac7d6d4fa8b9552203ef544a70d77;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git CPU HOTPLUG: avoid hotadd when proper possible_map isn't specified cpu-hot-add should be fail if cpu is not set in cpu_possible_map. If go ahead, the system will panic soon. Especially, arch which requires additional_cpus= parameter should handle this. Tested on ia64. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: KAMEZAWA Hiroyuki Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/cpu.c b/kernel/cpu.c index ebf6647a2bd4..6b3a0c15144f 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -265,6 +265,15 @@ out_notify: int __cpuinit cpu_up(unsigned int cpu) { int err = 0; + if (!cpu_isset(cpu, cpu_possible_map)) { + printk(KERN_ERR "can't online cpu %d because it is not " + "configured as may-hotadd at boot time\n", cpu); +#if defined(CONFIG_IA64) || defined(CONFIG_X86_64) || defined(CONFIG_S390) + printk(KERN_ERR "please check additional_cpus= boot " + "parameter\n"); +#endif + return -EINVAL; + } mutex_lock(&cpu_add_remove_lock); if (cpu_hotplug_disabled)