Commit 697863bf authored by Jerry Snitselaar's avatar Jerry Snitselaar Committed by Greg Kroah-Hartman

iommu/amd: Call free_iova_fast with pfn in map_sg

[ Upstream commit 51d8838d ]

In the error path of map_sg, free_iova_fast is being called with
address instead of the pfn. This results in a bad value getting into
the rcache, and can result in hitting a BUG_ON when
iova_magazine_free_pfns is called.

Cc: Joerg Roedel <joro@8bytes.org>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: default avatarJerry Snitselaar <jsnitsel@redhat.com>
Fixes: 80187fd3 ("iommu/amd: Optimize map_sg and unmap_sg")
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 43b0c939
...@@ -2561,7 +2561,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, ...@@ -2561,7 +2561,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
} }
out_free_iova: out_free_iova:
free_iova_fast(&dma_dom->iovad, address, npages); free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages);
out_err: out_err:
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment