]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iommu/amd: Unmap all mapped pages in error path of map_sg
authorJerry Snitselaar <jsnitsel@redhat.com>
Sat, 19 Jan 2019 17:38:05 +0000 (10:38 -0700)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit90b29e60d21afe77cf48d770c435a26e9873fcb1
treef805baa155b8823ad525c1c728b7c2f5e543fc61
parent7e50af0cb27199e988663340ebcbe745dfead9e1
iommu/amd: Unmap all mapped pages in error path of map_sg

BugLink: https://bugs.launchpad.net/bugs/1837813
[ Upstream commit f1724c0883bb0ce93b8dcb94b53dcca3b75ac9a7 ]

In the error path of map_sg there is an incorrect if condition
for breaking out of the loop that searches the scatterlist
for mapped pages to unmap. Instead of breaking out of the
loop once all the pages that were mapped have been unmapped,
it will break out of the loop after it has unmapped 1 page.
Fix the condition, so it breaks out of the loop only after
all the mapped pages have been unmapped.

Fixes: 80187fd39dcb ("iommu/amd: Optimize map_sg and unmap_sg")
Cc: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/iommu/amd_iommu.c