[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211027174757.119755-1-logang@deltatee.com>
Date: Wed, 27 Oct 2021 11:47:57 -0600
From: Logan Gunthorpe <logang@...tatee.com>
To: linux-kernel@...r.kernel.org, iommu@...ts.linux-foundation.org,
Christoph Hellwig <hch@....de>
Cc: Logan Gunthorpe <logang@...tatee.com>,
Marshall Midden <marshallmidden@...il.com>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>
Subject: [PATCH] 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: Marshall Midden <marshallmidden@...il.com>
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 <logang@...tatee.com>
Cc: Joerg Roedel <joro@...tes.org>
Cc: Will Deacon <will@...nel.org>
---
drivers/iommu/dma-iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
If possible, this fix should really get into Linus's tree before the
v5.15 release.
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 896bea04c347..3e5a21b0bb24 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -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))
base-commit: 3906fe9bb7f1a2c8667ae54e967dc8690824f4ea
--
2.30.2
Powered by blists - more mailing lists