diff options
author | Viller Hsiao <villerhsiao@gmail.com> | 2014-02-22 02:46:49 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-03-17 10:42:07 -0400 |
commit | a4671094227d11985c06ee1178d7205c5fd39f8a (patch) | |
tree | 78e1b59f3b9803c1ac6e3ef702fdc2f3da06c969 | |
parent | 86ca57b5a5525dbf89fc2a3285781fae807276b0 (diff) |
MIPS: ftrace: Fix icache flush range error
In 32-bit mode, the start address passed to flush_icache_range is
shifted by 4 bytes before the second safe_store_code() call.
This causes system crash from time to time because the first 4 bytes
might not be flushed properly. This bug exists since linux-3.8.
Also remove obsoleted comment while at it.
Signed-off-by: Viller Hsiao <villerhsiao@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: rostedt@goodmis.org
Cc: fweisbec@gmail.com
Cc: mingo@redhat.com
Cc: Qais.Yousef@imgtec.com
Patchwork: https://patchwork.linux-mips.org/patch/6586/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/kernel/ftrace.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index 185ba258361b..374ed74cd516 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c | |||
@@ -111,11 +111,10 @@ static int ftrace_modify_code_2(unsigned long ip, unsigned int new_code1, | |||
111 | safe_store_code(new_code1, ip, faulted); | 111 | safe_store_code(new_code1, ip, faulted); |
112 | if (unlikely(faulted)) | 112 | if (unlikely(faulted)) |
113 | return -EFAULT; | 113 | return -EFAULT; |
114 | ip += 4; | 114 | safe_store_code(new_code2, ip + 4, faulted); |
115 | safe_store_code(new_code2, ip, faulted); | ||
116 | if (unlikely(faulted)) | 115 | if (unlikely(faulted)) |
117 | return -EFAULT; | 116 | return -EFAULT; |
118 | flush_icache_range(ip, ip + 8); /* original ip + 12 */ | 117 | flush_icache_range(ip, ip + 8); |
119 | return 0; | 118 | return 0; |
120 | } | 119 | } |
121 | #endif | 120 | #endif |