From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvyEW-0006QB-MH for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:01:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvyEL-0006JT-Nf for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:54 -0400 Received: from [199.232.76.173] (port=52369 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvyEK-0006II-P1 for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24388) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvyEG-00074n-HU for qemu-devel@nongnu.org; Thu, 08 Oct 2009 15:00:45 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n98J0fmZ000694 for ; Thu, 8 Oct 2009 15:00:43 -0400 From: Mark McLoughlin Date: Thu, 8 Oct 2009 19:58:18 +0100 Message-Id: <1255028312-28180-3-git-send-email-markmc@redhat.com> In-Reply-To: <1255028312-28180-1-git-send-email-markmc@redhat.com> References: <1255028312-28180-1-git-send-email-markmc@redhat.com> Subject: [Qemu-devel] [PATCH 02/16] hotplug: safely iterate bus's sibling list while removing a device List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Mark McLoughlin , Gerd Hoffmann Without this, I'm seeing a segfault when unpluging a NIC. Cc: Gerd Hoffmann Signed-off-by: Mark McLoughlin --- 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