iommu: amd: call free_iova_fast with pfn in map_sg
PATCH 1/1 iommu: amd: call free_iova_fast with pfn in map_sg
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.
--- drivers/iommu/amd_iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd_iommu.c +1 -1
@@ -2623,7 +2623,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, } out_free_iova: -free_iova_fast (&dma_dom->iovad, address, npages); +free_iova_fast (&dma_dom->iovad, address >>PAGE_SHIFT , npages); out_err:return 0 ;
Signature · 1 line
2.20.1.98.gecbdaf0899
Quoted 23 lines · Jerry Snitselaar
In the error path of
map_sg,free_iova_fastis being called with address instead of the pfn. This results in a bad value getting into the rcache, and can result in hitting aBUG_ONwheniova_magazine_free_pfnsis called.Cc Joerg Roedel <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>---
drivers/iommu/amd_iommu.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/iommu/amd_iommu.c +0
-0@@ -2623,7 +2623,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist, }
out_free_iova:drivers/iommu/amd_iommu.c +1
-1-free_iova_fast (&dma_dom->iovad, address, npages); +free_iova_fast (&dma_dom->iovad, address >>PAGE_SHIFT , npages);
Quoted 5 lines
out_err:return 0;Signature · 1 line
2.20.1.98.gecbdaf0899
I forgot to add the Fixes line.
Quoted 8 lines · Jerry Snitselaar
In the error path of
map_sg,free_iova_fastis being called with address instead of the pfn. This results in a bad value getting into the rcache, and can result in hitting aBUG_ONwheniova_magazine_free_pfnsis called.Cc Joerg Roedel <[email protected]>Cc Suravee Suthikulpanit <[email protected]>Signed-off-by Jerry Snitselaar <[email protected]>
Applied, thanks.