]> Pileus Git - ~andy/linux/commitdiff
kprobes/mips: Fix to check double free of insn slot
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Wed, 22 May 2013 08:34:13 +0000 (08:34 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 22 May 2013 10:48:30 +0000 (12:48 +0200)
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>
arch/mips/kernel/kprobes.c

index 12bc4ebdf55b6bf5e087532feafcaddca94b417e..1f8187ab0997be478f69b66eadb8ac4a6bf7e489 100644 (file)
@@ -207,7 +207,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
 
 void __kprobes arch_remove_kprobe(struct kprobe *p)
 {
-       free_insn_slot(p->ainsn.insn, 0);
+       if (p->ainsn.insn) {
+               free_insn_slot(p->ainsn.insn, 0);
+               p->ainsn.insn = NULL;
+       }
 }
 
 static void save_previous_kprobe(struct kprobe_ctlblk *kcb)