[PATCH 01/19] pci-assign: Only clean up registered IO resources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(&region->container,
-                                        &region->real_iomem);
-            memory_region_destroy(&region->real_iomem);
-            memory_region_destroy(&region->container);
+            if (region->u.r_baseport) {
+                memory_region_del_subregion(&region->container,
+                                            &region->real_iomem);
+                memory_region_destroy(&region->real_iomem);
+                memory_region_destroy(&region->container);
+            }
         } else if (pci_region->type & IORESOURCE_MEM) {
             if (region->u.r_virtbase) {
                 memory_region_del_subregion(&region->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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux