Skip to content

Commit 53892dc

Browse files
Simon Xuegregkh
authored andcommitted
iommu/rockchip: prevent iommus dead loop when two masters share one IOMMU
commit 62e062a upstream. When two masters share an IOMMU, calling ops->of_xlate during the second master's driver init may overwrite iommu->domain set by the first. This causes the check if (iommu->domain == domain) in rk_iommu_attach_device() to fail, resulting in the same iommu->node being added twice to &rk_domain->iommus, which can lead to an infinite loop in subsequent &rk_domain->iommus operations. Cc: <[email protected]> Fixes: 25c2325 ("iommu/rockchip: Add missing set_platform_dma_ops callback") Signed-off-by: Simon Xue <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5f28563 commit 53892dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/iommu/rockchip-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,6 @@ static int rk_iommu_of_xlate(struct device *dev,
11541154
iommu_dev = of_find_device_by_node(args->np);
11551155

11561156
data->iommu = platform_get_drvdata(iommu_dev);
1157-
data->iommu->domain = &rk_identity_domain;
11581157
dev_iommu_priv_set(dev, data);
11591158

11601159
platform_device_put(iommu_dev);
@@ -1192,6 +1191,8 @@ static int rk_iommu_probe(struct platform_device *pdev)
11921191
if (!iommu)
11931192
return -ENOMEM;
11941193

1194+
iommu->domain = &rk_identity_domain;
1195+
11951196
platform_set_drvdata(pdev, iommu);
11961197
iommu->dev = dev;
11971198
iommu->num_mmu = 0;

0 commit comments

Comments
 (0)