Skip to content

Commit

Permalink
iommu: Check for deferred attach in iommu_group_do_dma_attach()
Browse files Browse the repository at this point in the history
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 <jsnitsel@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Tested-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Link: https://lore.kernel.org/r/20200604091944.26402-1-joro@8bytes.org
  • Loading branch information
Joerg Roedel committed Jun 4, 2020
1 parent cc69fc4 commit 431275a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/iommu/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1680,8 +1680,12 @@ static void probe_alloc_default_domain(struct bus_type *bus,
static int iommu_group_do_dma_attach(struct device *dev, void *data)
{
struct iommu_domain *domain = data;
int ret = 0;

return __iommu_attach_device(domain, dev);
if (!iommu_is_attach_deferred(domain, dev))
ret = __iommu_attach_device(domain, dev);

return ret;
}

static int __iommu_group_dma_attach(struct iommu_group *group)
Expand Down

0 comments on commit 431275a

Please sign in to comment.