From patchwork Thu May 19 09:13:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 96331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3B44CB6F77 for ; Thu, 19 May 2011 19:13:40 +1000 (EST) Received: from localhost ([::1]:56191 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMzIX-0008RT-Bv for incoming@patchwork.ozlabs.org; Thu, 19 May 2011 05:13:37 -0400 Received: from eggs.gnu.org ([140.186.70.92]:43247) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMzII-0008Qf-Kr for qemu-devel@nongnu.org; Thu, 19 May 2011 05:13:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMzIH-0005G0-4E for qemu-devel@nongnu.org; Thu, 19 May 2011 05:13:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMzIG-0005Fm-RS for qemu-devel@nongnu.org; Thu, 19 May 2011 05:13:21 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4J9DJbO015525 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 May 2011 05:13:20 -0400 Received: from rincewind.home.kraxel.org (vpn2-10-223.ams2.redhat.com [10.36.10.223]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4J9DGOw004887; Thu, 19 May 2011 05:13:18 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 4266140027; Thu, 19 May 2011 11:13:14 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 19 May 2011 11:13:13 +0200 Message-Id: <1305796393-22786-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1305796393-22786-1-git-send-email-kraxel@redhat.com> References: <1305796393-22786-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch makes qemu ignore unplug requests from the guest for pci devices which are tagged as non-hotpluggable. Trouble spot is the piix4 chipset with the ISA bridge. Requests to unplug that one will make it go away together with all ISA bus devices, which are not prepared to be unplugged and thus don't cleanup, leaving active qemu timers behind in free'ed memory. Signed-off-by: Gerd Hoffmann --- hw/acpi_piix4.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c index 96f5222..6c908ff 100644 --- a/hw/acpi_piix4.c +++ b/hw/acpi_piix4.c @@ -471,11 +471,13 @@ static void pciej_write(void *opaque, uint32_t addr, uint32_t val) BusState *bus = opaque; DeviceState *qdev, *next; PCIDevice *dev; + PCIDeviceInfo *info; int slot = ffs(val) - 1; QLIST_FOREACH_SAFE(qdev, &bus->children, sibling, next) { dev = DO_UPCAST(PCIDevice, qdev, qdev); - if (PCI_SLOT(dev->devfn) == slot) { + info = container_of(qdev->info, PCIDeviceInfo, qdev); + if (PCI_SLOT(dev->devfn) == slot && !info->no_hotplug) { qdev_free(qdev); } }