summaryrefslogtreecommitdiffstats
path: root/drivers/iommu
diff options
context:
space:
mode:
authorZhen Lei <thunder.leizhen@huawei.com>2018-06-06 04:18:46 +0200
committerJoerg Roedel <jroedel@suse.de>2018-07-06 13:21:32 +0200
commit3c120143f584360a13614787e23ae2cdcb5e5ccd (patch)
tree738662d4923731b123b9c643ab4a0b395837eaef /drivers/iommu
parentiommu/amd: Argument page_size could be uninitialized (diff)
downloadlinux-3c120143f584360a13614787e23ae2cdcb5e5ccd.tar.xz
linux-3c120143f584360a13614787e23ae2cdcb5e5ccd.zip
iommu/amd: make sure TLB to be flushed before IOVA freed
Although the mapping has already been removed in the page table, it maybe still exist in TLB. Suppose the freed IOVAs is reused by others before the flush operation completed, the new user can not correctly access to its meomory. Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Fixes: b1516a14657a ('iommu/amd: Implement flush queue') 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 e688169721b8..874e6480e391 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2407,9 +2407,9 @@ static void __unmap_single(struct dma_ops_domain *dma_dom,
}
if (amd_iommu_unmap_flush) {
- dma_ops_free_iova(dma_dom, dma_addr, pages);
domain_flush_tlb(&dma_dom->domain);
domain_flush_complete(&dma_dom->domain);
+ dma_ops_free_iova(dma_dom, dma_addr, pages);
} else {
pages = __roundup_pow_of_two(pages);
queue_iova(&dma_dom->iovad, dma_addr >> PAGE_SHIFT, pages, 0);