diff options
author | Jiang Liu <jiang.liu@linux.intel.com> | 2014-07-11 02:19:31 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2014-07-23 10:04:47 -0400 |
commit | 129ad28100cccc0ff01f2227dd8d0849c0114ade (patch) | |
tree | 465a8c978895755ef6279bdcd776d456e4d7574f /drivers/iommu/intel-iommu.c | |
parent | 2a46ddf77c32da1f4137aeb902bc4e1f50582b69 (diff) |
iommu/vt-d: Avoid freeing virtual machine domain in free_dmar_iommu()
Virtual machine domains are created by intel_iommu_domain_init() and
should be destroyed by intel_iommu_domain_destroy(). So avoid freeing
virtual machine domain data structure in free_dmar_iommu() when
doamin->iommu_count reaches zero, otherwise it may cause invalid
memory access because the IOMMU framework still holds references
to the domain structure.
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 0984fa58d872..5d7383775bf1 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1480,7 +1480,8 @@ static void free_dmar_iommu(struct intel_iommu *iommu) | |||
1480 | 1480 | ||
1481 | domain = iommu->domains[i]; | 1481 | domain = iommu->domains[i]; |
1482 | clear_bit(i, iommu->domain_ids); | 1482 | clear_bit(i, iommu->domain_ids); |
1483 | if (domain_detach_iommu(domain, iommu) == 0) | 1483 | if (domain_detach_iommu(domain, iommu) == 0 && |
1484 | !domain_type_is_vm(domain)) | ||
1484 | domain_exit(domain); | 1485 | domain_exit(domain); |
1485 | } | 1486 | } |
1486 | } | 1487 | } |