qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [FIX PATCH] spapr_rtas: Prevent QEMU crash during hotplug w


From: Bharata B Rao
Subject: [Qemu-devel] [FIX PATCH] spapr_rtas: Prevent QEMU crash during hotplug without a prior device_add
Date: Wed, 26 Aug 2015 09:34:11 +0530

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.

Signed-off-by: Bharata B Rao <address@hidden>
Cc: Michael Roth <address@hidden>
---
Not fully sure if RTAS_OUT_HW_ERROR is the right error code here. Should
we be using RTAS_OUT_NOT_SUPPORTED instead ?

 hw/ppc/spapr_rtas.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c
index e99e25f..3be8eec 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 = RTAS_OUT_HW_ERROR;
+        goto out;
+    }
 
     ccs = spapr_ccs_find(spapr, drc_index);
     if (!ccs) {
-- 
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]