spapr: prevent QEMU crash when CPU realization fails
commit6595ab31583ed3ca4a7820dc888fe2de3c37c8a2
authorBharata B Rao <bharata@linux.vnet.ibm.com>
Fri, 16 Jun 2017 01:37:53 +0000 (16 07:07 +0530)
committerDavid Gibson <david@gibson.dropbear.id.au>
Fri, 30 Jun 2017 04:03:31 +0000 (30 14:03 +1000)
treea75926388825be3656f68458e2c516ac01c290e4
parentfd356563683216cf3668a79388450747f6d1373b
spapr: prevent QEMU crash when CPU realization fails

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 <bharata@linux.vnet.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
hw/ppc/spapr_cpu_core.c