From 29c419f9c27677a4842fe2aef36dcf44b4321dfe Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Thu, 25 Aug 2022 08:09:44 +0200 Subject: [PATCH] smpboot: Fix cpu_wait_death for early cpu death Fix uninitialized variable in case cpu dies early. Reported-by: kernel test robot Cc: Andrew Morton Signed-off-by: Uros Bizjak --- kernel/smpboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/smpboot.c b/kernel/smpboot.c index f3cf1a9a8b44..2c7396da470c 100644 --- a/kernel/smpboot.c +++ b/kernel/smpboot.c @@ -433,7 +433,7 @@ bool cpu_wait_death(unsigned int cpu, int seconds) /* The outgoing CPU will normally get done quite quickly. */ if (atomic_read(&per_cpu(cpu_hotplug_state, cpu)) == CPU_DEAD) - goto update_state; + goto update_state_early; udelay(5); /* But if the outgoing CPU dawdles, wait increasingly long times. */ @@ -444,6 +444,7 @@ bool cpu_wait_death(unsigned int cpu, int seconds) break; sleep_jf = DIV_ROUND_UP(sleep_jf * 11, 10); } +update_state_early: oldstate = atomic_read(&per_cpu(cpu_hotplug_state, cpu)); update_state: if (oldstate == CPU_DEAD) { -- 2.31.1