From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Gerd Hoffmann 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> Subject: [Qemu-devel] [PATCH] Ignore pci unplug requests for unpluggable devices (CVE-2011-1751) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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); } } -- 1.7.1