From: Thomas Gleixner Date: Tue, 29 May 2018 15:49:05 +0000 (+0200) Subject: cpu/hotplug: Split do_cpu_down() X-Git-Tag: v4.1.12-124.31.3~660 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3bc66d9ca7e7753b157927a238e021415663d096;p=users%2Fjedix%2Flinux-maple.git cpu/hotplug: Split do_cpu_down() Split out the inner workings of do_cpu_down() to allow reuse of that function for the upcoming SMT disabling mechanism. No functional change. Signed-off-by: Thomas Gleixner Reviewed-by: Konrad Rzeszutek Wilk Acked-by: Ingo Molnar Orabug: 28220674 CVE: CVE-2018-3620 (cherry picked from commit cc1fe215e1efa406b03aa4389e6269b61342dec5) Signed-off-by: Mihai Carabas Reviewed-by: Darren Kenny Reviewed-by: Boris Ostrovsky Conflicts: kernel/cpu.c Contextual and we do not have cpuhp_state target. --- diff --git a/kernel/cpu.c b/kernel/cpu.c index f40ed44bb412..d3142aabd92d 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -444,20 +444,19 @@ out_release: return err; } +static int cpu_down_maps_locked(unsigned int cpu) +{ + if (cpu_hotplug_disabled) + return -EBUSY; + return _cpu_down(cpu, 0); +} + int __ref cpu_down(unsigned int cpu) { int err; cpu_maps_update_begin(); - - if (cpu_hotplug_disabled) { - err = -EBUSY; - goto out; - } - - err = _cpu_down(cpu, 0); - -out: + err = cpu_down_maps_locked(cpu); cpu_maps_update_done(); return err; }