]> git.proxmox.com Git - mirror_qemu.git/commitdiff
pci: Add missing drop of bus master AS reference
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Mon, 27 Mar 2017 04:40:30 +0000 (15:40 +1100)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 28 Mar 2017 23:35:23 +0000 (02:35 +0300)
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 <aik@ozlabs.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
hw/pci/pci.c

index e6b08e198840b587a2e9e627d948201162999566..bd8043c460ca224a928d4a1f4058a7e1d6cc2d4d 100644 (file)
@@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)
     pci_dev->bus->devices[pci_dev->devfn] = NULL;
     pci_config_free(pci_dev);
 
+    memory_region_del_subregion(&pci_dev->bus_master_container_region,
+                                &pci_dev->bus_master_enable_region);
     address_space_destroy(&pci_dev->bus_master_as);
 }