[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 13/21] spapr: prevent QEMU crash when CPU realization f
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 13/21] spapr: prevent QEMU crash when CPU realization fails |
Date: |
Fri, 30 Jun 2017 20:46:24 +1000 |
From: Bharata B Rao <address@hidden>
ICPState objects were being allocated before CPU thread realization.
However commit 9ed656631d73 (xics: setup cpu at realize time) reversed it
by allocating ICPState objects after CPU thread is realized. But it
didn't take care to fix the error path because of which we observe
a SIGSEGV when CPU thread realization fails during cold/hotplug.
Fix this by ensuring that we do object_unparent() of ICPState object
only in case when is was created earlier.
Signed-off-by: Bharata B Rao <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/spapr_cpu_core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
index d6719d5..ea278ce 100644
--- a/hw/ppc/spapr_cpu_core.c
+++ b/hw/ppc/spapr_cpu_core.c
@@ -178,7 +178,7 @@ static void spapr_cpu_core_realize_child(Object *child,
Error **errp)
sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
CPUState *cs = CPU(child);
PowerPCCPU *cpu = POWERPC_CPU(cs);
- Object *obj = NULL;
+ Object *obj;
object_property_set_bool(child, true, "realized", &local_err);
if (local_err) {
@@ -198,13 +198,14 @@ static void spapr_cpu_core_realize_child(Object *child,
Error **errp)
object_property_add_const_link(obj, ICP_PROP_CPU, child, &error_abort);
object_property_set_bool(obj, true, "realized", &local_err);
if (local_err) {
- goto error;
+ goto free_icp;
}
return;
-error:
+free_icp:
object_unparent(obj);
+error:
error_propagate(errp, local_err);
}
--
2.9.4
- [Qemu-ppc] [PULL 07/21] spapr: Fix migration of Radix guests, (continued)
- [Qemu-ppc] [PULL 07/21] spapr: Fix migration of Radix guests, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 08/21] target/ppc/excp_helper: Take BQL before calling cpu_interrupt(), David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 10/21] xics: directly register ICPState objects to vmstate, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 04/21] pseries: Reset CPU compatibility mode, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 14/21] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 05/21] ppc: Rework CPU compatibility testing across migration, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 18/21] spapr: Split DRC release from DRC detach, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 19/21] spapr: Make DRC reset force DRC into known state, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 15/21] target-ppc: Enable open-pic timers to count and generate interrupts, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 17/21] spapr: Eliminate DRC 'signalled' state variable, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 13/21] spapr: prevent QEMU crash when CPU realization fails,
David Gibson <=
- [Qemu-ppc] [PULL 11/21] spapr: fix migration of ICPState objects from/to older QEMU, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 20/21] spapr: Clean up DRC set_allocation_state path, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 16/21] spapr: Start hotplugged PCI devices in ISOLATED state, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 12/21] target/ppc: Proper cleanup when ppc_cpu_realizefn fails, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 03/21] pseries: Move CPU compatibility property to machine, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 21/21] spapr: Clean up DRC set_isolation_state() path, David Gibson, 2017/06/30
- Re: [Qemu-ppc] [Qemu-devel] [PULL 00/21] ppc-for-2.10 queue 20170730, Greg Kurz, 2017/06/30
- Re: [Qemu-ppc] [PULL 00/21] ppc-for-2.10 queue 20170730, Peter Maydell, 2017/06/30