aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Nowakowski <marcin.nowakowski@imgtec.com>2017-06-08 15:20:32 +0200
committerRalf Baechle <ralf@linux-mips.org>2017-06-08 15:37:33 +0200
commit519d3b7887a73dc2b1151bbc21ddc3bd2e655a0e (patch)
treecd7d2a5aeb0d6b61254d794d222e331764ded40e
parentdf06f595691f53ce628c99c0e1dd93438d630afa (diff)
downloadlinux-3.9-stable.tar.gz
MIPS: kprobes: flush_insn_slot should flush only if probe initialisedlinux-3.9-stable
When ftrace is used with kprobes, it is possible for a kprobe to contain an invalid location (ie. only initialised to 0 and not to a specific location in the code). Trying to perform a cache flush on such location leads to a crash r4k_flush_icache_range(). Fixes: c1bf207d6ee1 ("MIPS: kprobe: Add support.") Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/16296/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> (cherry picked from commit a1497c7641ff53ca3632e87030fc905f73f2e7a5)
-rw-r--r--arch/mips/include/asm/kprobes.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobes.h
index daba1f9a4f7939..174aedce3167ae 100644
--- a/arch/mips/include/asm/kprobes.h
+++ b/arch/mips/include/asm/kprobes.h
@@ -40,7 +40,8 @@ typedef union mips_instruction kprobe_opcode_t;
#define flush_insn_slot(p) \
do { \
- flush_icache_range((unsigned long)p->addr, \
+ if (p->addr) \
+ flush_icache_range((unsigned long)p->addr, \
(unsigned long)p->addr + \
(MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
} while (0)