]> xenbits.xensource.com Git - xen.git/commitdiff
IOMMU: always call teardown callback
authorOleksandr Tyshchenko <olekstysh@gmail.com>
Wed, 15 Feb 2017 12:20:55 +0000 (12:20 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 15 Feb 2017 12:20:55 +0000 (12:20 +0000)
There is a possible scenario when (d)->need_iommu remains unset
during guest domain execution. For example, when no devices
were assigned to it. Taking into account that teardown callback
is not called when (d)->need_iommu is unset we might have unreleased
resourses after destroying domain.

So, always call teardown callback to roll back actions
that were performed in init callback.

This is XSA-207.

Signed-off-by: Oleksandr Tyshchenko <olekstysh@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Julien Grall <julien.grall@arm.com>
xen/drivers/passthrough/iommu.c

index 9d104d28a4e37dffe7b44c4de7af32f8f6a8e80a..1a315ee72d63929b8018d9380cc37c08e8f00773 100644 (file)
@@ -230,8 +230,7 @@ void iommu_domain_destroy(struct domain *d)
     if ( !iommu_enabled || !dom_iommu(d)->platform_ops )
         return;
 
-    if ( need_iommu(d) )
-        iommu_teardown(d);
+    iommu_teardown(d);
 
     arch_iommu_domain_destroy(d);
 }