]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.36/parisc-fix-race-in-pci-dma.c.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.4.36 / parisc-fix-race-in-pci-dma.c.patch
1 From c0452fb9fb8f49c7d68ab9fa0ad092016be7b45f Mon Sep 17 00:00:00 2001
2 From: John David Anglin <dave.anglin@bell.net>
3 Date: Thu, 24 Nov 2016 20:06:32 -0500
4 Subject: parisc: Fix race in pci-dma.c
5
6 From: John David Anglin <dave.anglin@bell.net>
7
8 commit c0452fb9fb8f49c7d68ab9fa0ad092016be7b45f upstream.
9
10 We are still troubled by occasional random segmentation faults and
11 memory memory corruption on SMP machines. The causes quite a few
12 package builds to fail on the Debian buildd machines for parisc. When
13 gcc-6 failed to build three times in a row, I looked again at the TLB
14 related code. I found a couple of issues. This is the first.
15
16 In general, we need to ensure page table updates and corresponding TLB
17 purges are atomic. The attached patch fixes an instance in pci-dma.c
18 where the page table update was not guarded by the TLB lock.
19
20 Tested on rp3440 and c8000. So far, no further random segmentation
21 faults have been observed.
22
23 Signed-off-by: John David Anglin <dave.anglin@bell.net>
24 Signed-off-by: Helge Deller <deller@gmx.de>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
26
27 ---
28 arch/parisc/kernel/pci-dma.c | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31 --- a/arch/parisc/kernel/pci-dma.c
32 +++ b/arch/parisc/kernel/pci-dma.c
33 @@ -95,8 +95,8 @@ static inline int map_pte_uncached(pte_t
34
35 if (!pte_none(*pte))
36 printk(KERN_ERR "map_pte_uncached: page already exists\n");
37 - set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
38 purge_tlb_start(flags);
39 + set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
40 pdtlb_kernel(orig_vaddr);
41 purge_tlb_end(flags);
42 vaddr += PAGE_SIZE;