cpu/hotplug: Fix off by one in cpuhp_bringup_mask()
authorThomas Gleixner <tglx@linutronix.de>
Mon, 22 May 2023 23:12:26 +0000 (01:12 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 23 May 2023 16:06:40 +0000 (18:06 +0200)
commit06c6796e0304234da65e70577f354cb194086521
tree32e284d764d319fdd45e21160b8f3510781204bd
parent6a4be6984595b164b6f281c5b242dbdf1c06d528
cpu/hotplug: Fix off by one in cpuhp_bringup_mask()

cpuhp_bringup_mask() iterates over a cpumask and starts all present CPUs up
to a caller provided upper limit.

The limit variable is decremented and checked for 0 before invoking
cpu_up(), which is obviously off by one and prevents the bringup of the
last CPU when the limit is equal to the number of present CPUs.

Move the decrement and check after the cpu_up() invocation.

Fixes: 18415f33e2ac ("cpu/hotplug: Allow "parallel" bringup up to CPUHP_BP_KICK_AP_STATE")
Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/87wn10ufj9.ffs@tglx
kernel/cpu.c