]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iommu/vt-d: Avoid duplicate device_domain_info structures
authorJoerg Roedel <jroedel@suse.de>
Thu, 23 Jul 2015 16:37:13 +0000 (18:37 +0200)
committerJoerg Roedel <jroedel@suse.de>
Wed, 12 Aug 2015 14:23:37 +0000 (16:23 +0200)
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>
drivers/iommu/intel-iommu.c

index 6e61b3eb47e88d84c0970d3e4daaf7bc5565c483..8834765e90c68a6736406a7bc26cd2e206b93cb1 100644 (file)
@@ -2270,12 +2270,16 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
        spin_lock_irqsave(&device_domain_lock, flags);
        if (dev)
                found = find_domain(dev);
-       else {
+
+       if (!found) {
                struct device_domain_info *info2;
                info2 = dmar_search_domain_by_dev_info(iommu->segment, bus, devfn);
-               if (info2)
-                       found = info2->domain;
+               if (info2) {
+                       found      = info2->domain;
+                       info2->dev = dev;
+               }
        }
+
        if (found) {
                spin_unlock_irqrestore(&device_domain_lock, flags);
                free_devinfo_mem(info);