]> Git Repo - J-linux.git/commitdiff
iommu/dma: Fix incorrect error return on iommu deferred attach
authorLogan Gunthorpe <[email protected]>
Wed, 27 Oct 2021 17:47:57 +0000 (11:47 -0600)
committerJoerg Roedel <[email protected]>
Thu, 28 Oct 2021 17:59:40 +0000 (19:59 +0200)
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: Marshall Midden <[email protected]>
Fixes: dabb16f67215 ("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: Logan Gunthorpe <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Will Deacon <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joerg Roedel <[email protected]>
drivers/iommu/dma-iommu.c

index 896bea04c347e6719198705b7f13c2d0e605ff68..3e5a21b0bb24e67821e84654ab965612aff32dd6 100644 (file)
@@ -1016,7 +1016,8 @@ 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);
-               goto out;
+               if (ret)
+                       goto out;
        }
 
        if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
This page took 0.053189 seconds and 4 git commands to generate.