diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-07-23 12:37:13 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-08-12 10:23:37 -0400 |
commit | f303e50766298feac17c8715e29ecd14b2c12680 (patch) | |
tree | 1b4c3dcff85a489251f17e04c2fb4dbc125f70f1 /drivers/iommu/intel-iommu.c | |
parent | 08a7f456a759e971caf0cc13987a963de2b0ae7c (diff) |
iommu/vt-d: Avoid duplicate device_domain_info structures
When a 'struct device_domain_info' is created as an alias
for another device, this struct will not be re-used when the
real device is encountered. Fix that to avoid duplicate
device_domain_info structures being added.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 6e61b3eb47e8..8834765e90c6 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2270,12 +2270,16 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, | |||
2270 | spin_lock_irqsave(&device_domain_lock, flags); | 2270 | spin_lock_irqsave(&device_domain_lock, flags); |
2271 | if (dev) | 2271 | if (dev) |
2272 | found = find_domain(dev); | 2272 | found = find_domain(dev); |
2273 | else { | 2273 | |
2274 | if (!found) { | ||
2274 | struct device_domain_info *info2; | 2275 | struct device_domain_info *info2; |
2275 | info2 = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn); | 2276 | info2 = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn); |
2276 | if (info2) | 2277 | if (info2) { |
2277 | found = info2->domain; | 2278 | found = info2->domain; |
2279 | info2->dev = dev; | ||
2280 | } | ||
2278 | } | 2281 | } |
2282 | |||
2279 | if (found) { | 2283 | if (found) { |
2280 | spin_unlock_irqrestore(&device_domain_lock, flags); | 2284 | spin_unlock_irqrestore(&device_domain_lock, flags); |
2281 | free_devinfo_mem(info); | 2285 | free_devinfo_mem(info); |