aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-10-08 19:58:18 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-15 09:32:00 -0500
commit98449371228d7636caa6a1dfbd681be827048eda (patch)
treec20539c14a5a834af2feaa123360e9918d932ccf /hw/acpi.c
parent3706c43f021918684cf19fe0f6ef8498815e4313 (diff)
hotplug: safely iterate bus's sibling list while removing a device
Without this, I'm seeing a segfault when unpluging a NIC. Cc: Gerd Hoffmann <kraxel@redhat.com> Patchworks-ID: 35519 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/acpi.c')
-rw-r--r--hw/acpi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/acpi.c b/hw/acpi.c
index 437313309f..d73aee99ae 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)