Skip to content

Commit ac315f9

Browse files
lsgunthjoergroedel
authored andcommitted
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@gmail.com> Fixes: dabb16f ("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@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: Joerg Roedel <jroedel@suse.de>
1 parent 3906fe9 commit ac315f9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/iommu/dma-iommu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,8 @@ static int iommu_dma_map_sg(struct device *dev, struct scatterlist *sg,
10161016

10171017
if (static_branch_unlikely(&iommu_deferred_attach_enabled)) {
10181018
ret = iommu_deferred_attach(dev, domain);
1019-
goto out;
1019+
if (ret)
1020+
goto out;
10201021
}
10211022

10221023
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))

0 commit comments

Comments
 (0)