mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
xen/iommu: Check if the IOMMU was initialized before tearing down
is_iommu_enabled() will return true even if the IOMMU has not been
initialized (e.g. the ops are not set).
In the case of an early failure in arch_domain_init(), the function
iommu_destroy_domain() will be called even if the IOMMU is not
initialized.
This will result to dereference the ops which will be NULL and an host
crash.
Fix the issue by checking that ops has been set before accessing it.
Fixes: 71e617a6b8 ("use is_iommu_enabled() where appropriate...")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
1 parent
3b1cc15f19
commit
d670ef3401
1 file changed
+7
@@ -221,6 +221,13 @@ static void iommu_teardown(struct domain *d)
|
||||
{
|
||||
struct domain_iommu *hd = dom_iommu(d);
|
||||
|
||||
/*
|
||||
* During early domain creation failure, we may reach here with the
|
||||
* ops not yet initialized.
|
||||
*/
|
||||
if ( !hd->platform_ops )
|
||||
return;
|
||||
|
||||
iommu_vcall(hd->platform_ops, teardown, d);
|
||||
}
|
||||
|
||||
|
||||