]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.3.8/parisc-fix-panic-on-prefetch-null-on-pa7300lc.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.3.8 / parisc-fix-panic-on-prefetch-null-on-pa7300lc.patch
1 From b3cb8674811d1851bbf1486a73d62b90c119b994 Mon Sep 17 00:00:00 2001
2 From: James Bottomley <JBottomley@Parallels.com>
3 Date: Wed, 16 May 2012 11:10:27 +0100
4 Subject: PARISC: fix panic on prefetch(NULL) on PA7300LC
5
6 From: James Bottomley <JBottomley@Parallels.com>
7
8 commit b3cb8674811d1851bbf1486a73d62b90c119b994 upstream.
9
10 Due to an errata, the PA7300LC generates a TLB miss interruption even on the
11 prefetch instruction. This means that prefetch(NULL), which is supposed to be
12 a nop on linux actually generates a NULL deref fault. Fix this by testing the
13 address of prefetch against NULL before doing the prefetch.
14
15 Signed-off-by: James Bottomley <JBottomley@Parallels.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17
18 ---
19 arch/parisc/include/asm/prefetch.h | 7 ++++++-
20 1 file changed, 6 insertions(+), 1 deletion(-)
21
22 --- a/arch/parisc/include/asm/prefetch.h
23 +++ b/arch/parisc/include/asm/prefetch.h
24 @@ -21,7 +21,12 @@
25 #define ARCH_HAS_PREFETCH
26 static inline void prefetch(const void *addr)
27 {
28 - __asm__("ldw 0(%0), %%r0" : : "r" (addr));
29 + __asm__(
30 +#ifndef CONFIG_PA20
31 + /* Need to avoid prefetch of NULL on PA7300LC */
32 + " extrw,u,= %0,31,32,%%r0\n"
33 +#endif
34 + " ldw 0(%0), %%r0" : : "r" (addr));
35 }
36
37 /* LDD is a PA2.0 addition. */