From patchwork Thu Oct 8 18:58:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 35519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B944FB7B68 for ; Fri, 9 Oct 2009 06:37:37 +1100 (EST) Received: from localhost ([127.0.0.1]:43852 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mvynu-0002a4-01 for incoming@patchwork.ozlabs.org; Thu, 08 Oct 2009 15:37:34 -0400 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 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n98J09mn013316; Thu, 8 Oct 2009 15:00:20 -0400 Received: by blaa.localdomain (Postfix, from userid 500) id 19A92EEA9; Thu, 8 Oct 2009 19:58:32 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 02/16] hotplug: safely iterate bus's sibling list while removing a device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)