From nobody Thu May 2 13:02:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490589693838129.9838532585834; Sun, 26 Mar 2017 21:41:33 -0700 (PDT) Received: from localhost ([::1]:44308 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csMTD-0004Jm-HP for importer@patchew.org; Mon, 27 Mar 2017 00:41:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csMSP-00041d-Bb for qemu-devel@nongnu.org; Mon, 27 Mar 2017 00:40:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csMSM-00031e-8C for qemu-devel@nongnu.org; Mon, 27 Mar 2017 00:40:41 -0400 Received: from ozlabs.ru ([107.173.13.209]:60768) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csMSM-00031F-1v for qemu-devel@nongnu.org; Mon, 27 Mar 2017 00:40:38 -0400 Received: from vpl2.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 469FC3A6032D; Mon, 27 Mar 2017 00:40:38 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Mon, 27 Mar 2017 15:40:30 +1100 Message-Id: <20170327044030.31306-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu] pci: Add missing drop of bus master AS reference X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "Michael S . Tsirkin" , Alexey Kardashevskiy , Jason Wang , Marcel Apfelbaum , Paolo Bonzini , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The recent introduction of a bus master container added memory_region_add_subregion() into the PCI device registering path but missed memory_region_del_subregion() in the unregistering path leaving a reference to the root memory region of the new container. This adds missing memory_region_del_subregion(). Fixes: 3716d5902d743 ("pci: introduce a bus master container") Signed-off-by: Alexey Kardashevskiy Acked-by: Jason Wang Reviewed-by: Paolo Bonzini --- hw/pci/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e6b08e1988..bd8043c460 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev) pci_dev->bus->devices[pci_dev->devfn] =3D NULL; pci_config_free(pci_dev); =20 + memory_region_del_subregion(&pci_dev->bus_master_container_region, + &pci_dev->bus_master_enable_region); address_space_destroy(&pci_dev->bus_master_as); } =20 --=20 2.11.0