We're destroying the memory container before we remove the subregions it holds. This fixes: https://bugs.launchpad.net/qemu/+bug/875723 Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx> --- hw/device-assignment.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 11efd16..cde0681 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -677,10 +677,23 @@ static void free_assigned_device(AssignedDevice *dev) kvm_remove_ioport_region(region->u.r_baseport, region->r_size, dev->dev.qdev.hotplugged); } + memory_region_del_subregion(®ion->container, + ®ion->real_iomem); + memory_region_destroy(®ion->real_iomem); + memory_region_destroy(®ion->container); } else if (pci_region->type & IORESOURCE_MEM) { if (region->u.r_virtbase) { memory_region_del_subregion(®ion->container, ®ion->real_iomem); + + /* Remove MSI-X table subregion */ + if (pci_region->base_addr <= dev->msix_table_addr && + pci_region->base_addr + pci_region->size > + dev->msix_table_addr) { + memory_region_del_subregion(®ion->container, + &dev->mmio); + } + memory_region_destroy(®ion->real_iomem); memory_region_destroy(®ion->container); if (munmap(region->u.r_virtbase, -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html