mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 13:41:55 +00:00
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>
This commit is contained in:
parent
08a7f456a7
commit
f303e50766
@ -2270,12 +2270,16 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
|
|||||||
spin_lock_irqsave(&device_domain_lock, flags);
|
spin_lock_irqsave(&device_domain_lock, flags);
|
||||||
if (dev)
|
if (dev)
|
||||||
found = find_domain(dev);
|
found = find_domain(dev);
|
||||||
else {
|
|
||||||
|
if (!found) {
|
||||||
struct device_domain_info *info2;
|
struct device_domain_info *info2;
|
||||||
info2 = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
|
info2 = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
|
||||||
if (info2)
|
if (info2) {
|
||||||
found = info2->domain;
|
found = info2->domain;
|
||||||
|
info2->dev = dev;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
spin_unlock_irqrestore(&device_domain_lock, flags);
|
spin_unlock_irqrestore(&device_domain_lock, flags);
|
||||||
free_devinfo_mem(info);
|
free_devinfo_mem(info);
|
||||||
|
Loading…
Reference in New Issue
Block a user