Skip to content

Commit 3c12014

Browse files
Zhen Leijoergroedel
authored andcommitted
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 <[email protected]> Fixes: b1516a1 ('iommu/amd: Implement flush queue') Signed-off-by: Joerg Roedel <[email protected]>
1 parent 4674686 commit 3c12014

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2407,9 +2407,9 @@ static void __unmap_single(struct dma_ops_domain *dma_dom,
24072407
}
24082408

24092409
if (amd_iommu_unmap_flush) {
2410-
dma_ops_free_iova(dma_dom, dma_addr, pages);
24112410
domain_flush_tlb(&dma_dom->domain);
24122411
domain_flush_complete(&dma_dom->domain);
2412+
dma_ops_free_iova(dma_dom, dma_addr, pages);
24132413
} else {
24142414
pages = __roundup_pow_of_two(pages);
24152415
queue_iova(&dma_dom->iovad, dma_addr >> PAGE_SHIFT, pages, 0);

0 commit comments

Comments
 (0)