Reproducer:
 $i386-softmmu/qemu-system-i386 -S -machine isapc,accel=tcg -device amd-iommu
Segmentation fault (core dumped)

Partial bt:
#0  bus_add_child (child=0x555556d4e520, bus=0x0) at hw/core/qdev.c:88
#1  qdev_set_parent_bus (dev=0x555556d4e520, bus=bus@entry=0x0)
at hw/core/qdev.c:119

Signed-off-by: Suramya Shah <shah.sura...@gmail.com>
---
 hw/core/qdev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 1e7fb33..07a211b 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -84,7 +84,11 @@ static void bus_add_child(BusState *bus, DeviceState *child)
 {
     char name[32];
     BusChild *kid = g_malloc0(sizeof(*kid));
-
+    
+    if (!bus) {
+        error_report("bus not found ");
+        exit(0);
+    }
     kid->index = bus->max_index++;
     kid->child = child;
     object_ref(OBJECT(kid->child));
-- 
2.9.3


Reply via email to