]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
parisc: Fix race in pci-dma.c
authorJohn David Anglin <dave.anglin@bell.net>
Fri, 25 Nov 2016 01:06:32 +0000 (20:06 -0500)
committerHelge Deller <deller@gmx.de>
Fri, 25 Nov 2016 11:31:59 +0000 (12:31 +0100)
We are still troubled by occasional random segmentation faults and
memory memory corruption on SMP machines.  The causes quite a few
package builds to fail on the Debian buildd machines for parisc.  When
gcc-6 failed to build three times in a row, I looked again at the TLB
related code.  I found a couple of issues.  This is the first.

In general, we need to ensure page table updates and corresponding TLB
purges are atomic.  The attached patch fixes an instance in pci-dma.c
where the page table update was not guarded by the TLB lock.

Tested on rp3440 and c8000.  So far, no further random segmentation
faults have been observed.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: <stable@vger.kernel.org> # v3.16+
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/pci-dma.c

index 02d9ed0f3949f29b0b8db1761e6fb10a43c49414..494ff6e8c88a471288b89aa15737ebae56a6f018 100644 (file)
@@ -95,8 +95,8 @@ static inline int map_pte_uncached(pte_t * pte,
 
                if (!pte_none(*pte))
                        printk(KERN_ERR "map_pte_uncached: page already exists\n");
-               set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
                purge_tlb_start(flags);
+               set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
                pdtlb_kernel(orig_vaddr);
                purge_tlb_end(flags);
                vaddr += PAGE_SIZE;