diff options
author | Bharata B Rao | 2015-09-01 01:53:52 +0200 |
---|---|---|
committer | David Gibson | 2015-09-23 02:51:09 +0200 |
commit | e6fc9568c865f2f81499475a4e322cd563fdfd90 (patch) | |
tree | 7ddd4c2bf817ccfe12d5c3213d06777e97429e38 /hw/ppc | |
parent | ppc/spapr: Use qemu_log_mask() for hcall_dprintf() (diff) | |
download | qemu-e6fc9568c865f2f81499475a4e322cd563fdfd90.tar.gz qemu-e6fc9568c865f2f81499475a4e322cd563fdfd90.tar.xz qemu-e6fc9568c865f2f81499475a4e322cd563fdfd90.zip |
spapr_rtas: Prevent QEMU crash during hotplug without a prior device_add
If drmgr is used in the guest to hotplug a device before a device_add
has been issued via the QEMU monitor, QEMU segfaults in configure_connector
call. This occurs due to accessing of NULL FDT which otherwise would have
been created and associated with the DRC during device_add command.
Check for NULL FDT and return failure from configure_connector call.
As per PAPR+, an error value of -9003 seems appropriate for this failure.
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/ppc')
-rw-r--r-- | hw/ppc/spapr_rtas.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 5cbf9a071a..2f8e25cfb2 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -522,6 +522,12 @@ static void rtas_ibm_configure_connector(PowerPCCPU *cpu, drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); fdt = drck->get_fdt(drc, NULL); + if (!fdt) { + DPRINTF("rtas_ibm_configure_connector: Missing FDT for DRC index: %xh\n", + drc_index); + rc = SPAPR_DR_CC_RESPONSE_NOT_CONFIGURABLE; + goto out; + } ccs = spapr_ccs_find(spapr, drc_index); if (!ccs) { |