Skip to content

Commit 431275a

Browse files
committed
iommu: Check for deferred attach in iommu_group_do_dma_attach()
The iommu_group_do_dma_attach() must not attach devices which have deferred_attach set. Otherwise devices could cause IOMMU faults when re-initialized in a kdump kernel. Fixes: deac0b3 ("iommu: Split off default domain allocation from group assignment") Reported-by: Jerry Snitselaar <[email protected]> Signed-off-by: Joerg Roedel <[email protected]> Tested-by: Jerry Snitselaar <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cc69fc4 commit 431275a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/iommu/iommu.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1680,8 +1680,12 @@ static void probe_alloc_default_domain(struct bus_type *bus,
16801680
static int iommu_group_do_dma_attach(struct device *dev, void *data)
16811681
{
16821682
struct iommu_domain *domain = data;
1683+
int ret = 0;
16831684

1684-
return __iommu_attach_device(domain, dev);
1685+
if (!iommu_is_attach_deferred(domain, dev))
1686+
ret = __iommu_attach_device(domain, dev);
1687+
1688+
return ret;
16851689
}
16861690

16871691
static int __iommu_group_dma_attach(struct iommu_group *group)

0 commit comments

Comments
 (0)