summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJerry Snitselaar <jsnitsel@redhat.com>2019-01-19 18:38:05 +0100
committerJoerg Roedel <jroedel@suse.de>2019-01-22 12:03:26 +0100
commitf1724c0883bb0ce93b8dcb94b53dcca3b75ac9a7 (patch)
treef8aea7ec9c19596860b497fc6e1369141b62d6d6 /drivers/iommu
parentiommu/amd: Call free_iova_fast with pfn in map_sg (diff)
downloadlinux-f1724c0883bb0ce93b8dcb94b53dcca3b75ac9a7.tar.xz
linux-f1724c0883bb0ce93b8dcb94b53dcca3b75ac9a7.zip
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: 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>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/amd_iommu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 418df8ff3e50..843b825cc1c4 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2617,7 +2617,7 @@ out_unmap:
bus_addr = address + s->dma_address + (j << PAGE_SHIFT);
iommu_unmap_page(domain, bus_addr, PAGE_SIZE);
- if (--mapped_pages)
+ if (--mapped_pages == 0)
goto out_free_iova;
}
}