All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] iommu/amd: make sure TLB to be flushed before IOVA freed
@ 2018-06-06  2:18 Zhen Lei
       [not found] ` <1528251526-11408-1-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  2018-07-06 11:21 ` Joerg Roedel
  0 siblings, 2 replies; 4+ messages in thread
From: Zhen Lei @ 2018-06-06  2:18 UTC (permalink / raw)
  To: Joerg Roedel, iommu, linux-kernel; +Cc: Zhen Lei, Robin Murphy

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>
---
 drivers/iommu/amd_iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 8fb8c73..93aa389 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2402,9 +2402,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);
--
1.8.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-06 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-06  2:18 [PATCH 1/1] iommu/amd: make sure TLB to be flushed before IOVA freed Zhen Lei
     [not found] ` <1528251526-11408-1-git-send-email-thunder.leizhen-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2018-06-21  6:08   ` Leizhen (ThunderTown)
2018-06-21  6:08     ` Leizhen (ThunderTown)
2018-07-06 11:21 ` Joerg Roedel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.