From 502e1d32f200399a9704f21143349e53e5b523ea Mon Sep 17 00:00:00 2001 From: Simon Xue Date: Wed, 20 Nov 2019 16:55:27 +0800 Subject: [PATCH] iommu: Don't break iommu_attach_device() if iommu shared by more than one master Don't break iommu_attach_device. iommu_attach_device will break if iommu shared by two or more masters Change-Id: Ifd1c652341e2270bfde57ebe1e0cd00d51d38eec Signed-off-by: Simon Xue --- drivers/iommu/iommu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 52eb5f1fd023..793c52826b08 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -1962,7 +1962,9 @@ int iommu_attach_device(struct iommu_domain *domain, struct device *dev) */ mutex_lock(&group->mutex); ret = -EINVAL; - if (iommu_group_device_count(group) != 1) + + /* don't break attach if iommu shared by more than one master */ + if (iommu_group_device_count(group) < 1) goto out_unlock; ret = __iommu_attach_group(domain, group);