Skip to content

Commit 51d8838

Browse files
snitsjoergroedel
authored andcommitted
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. Cc: Joerg Roedel <joro@8bytes.org> Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com> Fixes: 80187fd ("iommu/amd: Optimize map_sg and unmap_sg") Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent e8e683a commit 51d8838

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
26232623
}
26242624

26252625
out_free_iova:
2626-
free_iova_fast(&dma_dom->iovad, address, npages);
2626+
free_iova_fast(&dma_dom->iovad, address >> PAGE_SHIFT, npages);
26272627

26282628
out_err:
26292629
return 0;

0 commit comments

Comments
 (0)