Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kprobes/mips: Fix to check double free of insn slot

Fix to check double free of insn_slot at arch_remove_kprobe
as other arches do.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: Maneesh Soni <manesoni@cisco.com>
Cc: Victor Kamensky <kamensky@cisco.com>
Cc: linux-mips@linux-mips.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: yrl.pp-manager.tt@hitachi.com
Cc: systemtap@sourceware.org
Patchwork: https://patchwork.linux-mips.org/patch/5293/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Masami Hiramatsu and committed by
Ralf Baechle
22047b85 087d990b

+4 -1
+4 -1
arch/mips/kernel/kprobes.c
··· 207 207 208 208 void __kprobes arch_remove_kprobe(struct kprobe *p) 209 209 { 210 - free_insn_slot(p->ainsn.insn, 0); 210 + if (p->ainsn.insn) { 211 + free_insn_slot(p->ainsn.insn, 0); 212 + p->ainsn.insn = NULL; 213 + } 211 214 } 212 215 213 216 static void save_previous_kprobe(struct kprobe_ctlblk *kcb)