]> git.baikalelectronics.ru Git - 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)
committerJoerg Roedel <jroedel@suse.de>
Tue, 22 Jan 2019 11:03:26 +0000 (12:03 +0100)
commit1296748de4ace153f0672f054b9fc0723ff60ed3
treef8aea7ec9c19596860b497fc6e1369141b62d6d6
parent466d466ddd3a89202673f4d5b5ea8654f9977e09
iommu/amd: Unmap all mapped pages in error path of map_sg

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: eadfe8831b6e ("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>
drivers/iommu/amd_iommu.c