From: Oleksandr Tyshchenko Date: Wed, 15 Feb 2017 12:21:10 +0000 (+0000) Subject: IOMMU: always call teardown callback X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b648113f8a77b09c7c52cfd6f1594987e0f33d22;p=xen.git IOMMU: always call teardown callback 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 Reviewed-by: Jan Beulich Tested-by: Jan Beulich Tested-by: Julien Grall --- diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index a4fccc5274..5b96a46009 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -418,8 +418,7 @@ void iommu_domain_destroy(struct domain *d) if ( !iommu_enabled || !hd->platform_ops ) return; - if ( need_iommu(d) ) - iommu_teardown(d); + iommu_teardown(d); list_for_each_safe ( ioport_list, tmp, &hd->g2m_ioport_list ) {