If we fail before or inside assigned_dev_register_regions, we so far
unconditionally unregistered IO resources, triggering an assertion in
the memory layer. Non-null u.r_baseport tells us if the region has been
registered.
Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>
---
hw/device-assignment.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 7b55ac9..529e229 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -720,10 +720,12 @@ static void free_assigned_device(AssignedDevice *dev)
continue;
}
if (pci_region->type & IORESOURCE_IO) {
- memory_region_del_subregion(®ion->container,
- ®ion->real_iomem);
- memory_region_destroy(®ion->real_iomem);
- memory_region_destroy(®ion->container);
+ if (region->u.r_baseport) {
+ 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,
--
1.7.3.4
--
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
[KVM ARM]
[KVM ia64]
[KVM ppc]
[Spice Development]
[Libvirt]
[Libvirt Users]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Linux Kernel]
[Linux SCSI]
[XFree86]