[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] cpu: Assert a vCPU is created before resetting it
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 2/2] cpu: Assert a vCPU is created before resetting it |
Date: |
Mon, 9 Mar 2020 13:11:03 +0100 |
cpu_reset() might modify architecture-specific fields allocated
by qemu_init_vcpu(). To avoid bugs similar to the one fixed in
commit 00d0f7cb66 when introducing new architectures, assert a
vCPU is created before resetting it.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/core/cpu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
index fe65ca62ac..09e49f8d6a 100644
--- a/hw/core/cpu.c
+++ b/hw/core/cpu.c
@@ -251,6 +251,7 @@ void cpu_reset(CPUState *cpu)
{
CPUClass *klass = CPU_GET_CLASS(cpu);
+ assert(cpu->created);
if (klass->reset != NULL) {
(*klass->reset)(cpu);
}
--
2.21.1
[PATCH 2/2] cpu: Assert a vCPU is created before resetting it,
Philippe Mathieu-Daudé <=