]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.131/iommu-amd-make-sure-tlb-to-be-flushed-before-iova-freed.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.9.131 / iommu-amd-make-sure-tlb-to-be-flushed-before-iova-freed.patch
1 From foo@baz Sat Sep 29 04:29:21 PDT 2018
2 From: Zhen Lei <thunder.leizhen@huawei.com>
3 Date: Wed, 6 Jun 2018 10:18:46 +0800
4 Subject: iommu/amd: make sure TLB to be flushed before IOVA freed
5
6 From: Zhen Lei <thunder.leizhen@huawei.com>
7
8 [ Upstream commit 3c120143f584360a13614787e23ae2cdcb5e5ccd ]
9
10 Although the mapping has already been removed in the page table, it maybe
11 still exist in TLB. Suppose the freed IOVAs is reused by others before the
12 flush operation completed, the new user can not correctly access to its
13 meomory.
14
15 Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
16 Fixes: b1516a14657a ('iommu/amd: Implement flush queue')
17 Signed-off-by: Joerg Roedel <jroedel@suse.de>
18 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 drivers/iommu/amd_iommu.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/drivers/iommu/amd_iommu.c
25 +++ b/drivers/iommu/amd_iommu.c
26 @@ -2452,9 +2452,9 @@ static void __unmap_single(struct dma_op
27 }
28
29 if (amd_iommu_unmap_flush) {
30 - dma_ops_free_iova(dma_dom, dma_addr, pages);
31 domain_flush_tlb(&dma_dom->domain);
32 domain_flush_complete(&dma_dom->domain);
33 + dma_ops_free_iova(dma_dom, dma_addr, pages);
34 } else {
35 queue_add(dma_dom, dma_addr, pages);
36 }