iommu/amd: Call free_iova_fast with pfn in map_sg
authorJerry Snitselaar <jsnitsel@redhat.com>
Thu, 17 Jan 2019 19:29:02 +0000 (12:29 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:04:55 +0000 (14:04 -0700)
commit8a6c9f65e75526e72bc114638b97a624a7c7d9f8
tree1af85318f42dcc5a36abb27e3dd784c0abbf8511
parent8c310cd9fa235b00cc33443efc09acfd496b1078
iommu/amd: Call free_iova_fast with pfn in map_sg

[ Upstream commit 51d8838d66d3249508940d8f59b07701f2129723 ]

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: 80187fd39dcb ("iommu/amd: Optimize map_sg and unmap_sg")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iommu/amd_iommu.c