This is a note to let you know that I've just added the patch titled iommu/dma: Fix incorrect error return on iommu deferred attach to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iommu-dma-fix-incorrect-error-return-on-iommu-deferr.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit d866af7e8606fcf4befe2dffaf7df255a39a9f03 Author: Logan Gunthorpe <logang@xxxxxxxxxxxx> Date: Wed Oct 27 11:47:57 2021 -0600 iommu/dma: Fix incorrect error return on iommu deferred attach [ Upstream commit ac315f96b3bd6f6b8f18f387816c7c2cc6b32e02 ] 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@xxxxxxxxx> Fixes: dabb16f67215 ("iommu/dma: return error code from iommu_dma_map_sg()") Link: https://lore.kernel.org/all/CAD2CkAWjS8=kKwEEN4cgVNjyFORUibzEiCUA-X+SMtbo0JoMmA@xxxxxxxxxxxxxx Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx> Cc: Joerg Roedel <joro@xxxxxxxxxx> Cc: Will Deacon <will@xxxxxxxxxx> Link: https://lore.kernel.org/r/20211027174757.119755-1-logang@xxxxxxxxxxxx Signed-off-by: Joerg Roedel <jroedel@xxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 19bebacbf1780..2d60216440009 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1007,7 +1007,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 (dev_is_untrusted(dev))