aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-11-27 14:27:50 +1000
committerVasant Hegde <hegdevasant@linux.vnet.ibm.com>2021-01-06 16:31:35 +0530
commit739a0d608a2095d28dd02e2c0774b076258c81f1 (patch)
treeb4d626add67846883615cabb003eb02f195f561a
parent89a32b4930be829f37e6967354a759e38048d01f (diff)
downloadskiboot-739a0d608a2095d28dd02e2c0774b076258c81f1.zip
skiboot-739a0d608a2095d28dd02e2c0774b076258c81f1.tar.gz
skiboot-739a0d608a2095d28dd02e2c0774b076258c81f1.tar.bz2
core/cpu: fix next_ungarded_primary
[ Upstream commit 3f65437bb367ccf479fa6b9e905bf50ede359e9d ] next_unguarded_primary dereferences NULL CPU -> UB -> infinite loop Fast reboot works again after this patch. Fixes: 98f5834253c7e ("cpu: Keep track of the "ec_primary" in big core more") Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
-rw-r--r--core/cpu.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/cpu.c b/core/cpu.c
index ff0442a..d30bef8 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -823,11 +823,9 @@ struct cpu_thread *first_ungarded_cpu(void)
struct cpu_thread *next_ungarded_primary(struct cpu_thread *cpu)
{
- bool is_primary;
do {
- cpu = next_cpu(cpu);
- is_primary = cpu == cpu->primary || cpu == cpu->ec_primary;
- } while(cpu && (cpu->state == cpu_state_unavailable || !is_primary));
+ cpu = next_ungarded_cpu(cpu);
+ } while (cpu && !(cpu == cpu->primary || cpu == cpu->ec_primary));
return cpu;
}