Skip to content

Commit

Permalink
iommu/amd: Call free_iova_fast with pfn in map_sg
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jerry Snitselaar authored and Joerg Roedel committed Jan 22, 2019
1 parent e8e683a commit 51d8838
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 51d8838

Please sign in to comment.