qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 02/16] hotplug: safely iterate bus's sibling list wh


From: Mark McLoughlin
Subject: [Qemu-devel] [PATCH 02/16] hotplug: safely iterate bus's sibling list while removing a device
Date: Thu, 8 Oct 2009 19:58:18 +0100

Without this, I'm seeing a segfault when unpluging a NIC.

Cc: Gerd Hoffmann <address@hidden>
Signed-off-by: Mark McLoughlin <address@hidden>
---
 hw/acpi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/acpi.c b/hw/acpi.c
index 4373133..d73aee9 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -695,11 +695,11 @@ static uint32_t pciej_read(void *opaque, uint32_t addr)
 static void pciej_write(void *opaque, uint32_t addr, uint32_t val)
 {
     BusState *bus = opaque;
-    DeviceState *qdev;
+    DeviceState *qdev, *next;
     PCIDevice *dev;
     int slot = ffs(val) - 1;
 
-    QLIST_FOREACH(qdev, &bus->children, sibling) {
+    QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) {
         dev = DO_UPCAST(PCIDevice, qdev, qdev);
         if (PCI_SLOT(dev->devfn) == slot) {
 #if defined (TARGET_I386)
-- 
1.6.2.5





reply via email to

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