Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49f8d9d6 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "iommu: iommu-debug: Fix duplicate iommu_attachment entries"

parents d98de9bf 35af1bb5
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -102,20 +102,25 @@ void iommu_debug_attach_device(struct iommu_domain *domain,
	struct iommu_debug_attachment *attach;
	struct iommu_group *group;

	group = iommu_group_get(dev);
	group = dev->iommu_group;
	if (!group)
		return;

	mutex_lock(&iommu_debug_attachments_lock);
	list_for_each_entry(attach, &iommu_debug_attachments, list)
		if ((attach->domain == domain) && (attach->group == group))
			goto out;

	attach = kzalloc(sizeof(*attach), GFP_KERNEL);
	if (!attach)
		return;
		goto out;

	attach->domain = domain;
	attach->group = group;
	INIT_LIST_HEAD(&attach->list);

	mutex_lock(&iommu_debug_attachments_lock);
	list_add(&attach->list, &iommu_debug_attachments);
out:
	mutex_unlock(&iommu_debug_attachments_lock);
}

@@ -128,7 +133,6 @@ void iommu_debug_domain_remove(struct iommu_domain *domain)
		if (it->domain != domain)
			continue;
		list_del(&it->list);
		iommu_group_put(it->group);
		kfree(it);
	}