Commit ac315f96 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Joerg Roedel
Browse files

iommu/dma: Fix incorrect error return on iommu deferred attach



scsi_dma_map() was reporting a failure during boot on an AMD machine
with the IOMMU enabled.

  scsi_dma_map failed: request for 36 bytes!

The issue was tracked down to a mistake in logic: should not return
an error if iommu_deferred_attach() returns zero.

Reported-by: default avatarMarshall Midden <marshallmidden@gmail.com>
Fixes: dabb16f6 ("iommu/dma: return error code from iommu_dma_map_sg()")
Link: https://lore.kernel.org/all/CAD2CkAWjS8=kKwEEN4cgVNjyFORUibzEiCUA-X+SMtbo0JoMmA@mail.gmail.com


Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20211027174757.119755-1-logang@deltatee.com


Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 3906fe9b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1016,6 +1016,7 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,

	if (static_branch_unlikely(&iommu_deferred_attach_enabled)) {
		ret = iommu_deferred_attach(dev, domain);
		if (ret)
			goto out;
	}