linux-mips
[Top] [All Lists]

[PATCH 2/2] [BUGFIX] kprobes/mips: Fix to check double free of insn slot

To: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] [BUGFIX] kprobes/mips: Fix to check double free of insn slot
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Date: Wed, 22 May 2013 18:34:13 +0900
Cc: linux-mips@linux-mips.org, Victor Kamensky <kamensky@cisco.com>, David Daney <ddaney@caviumnetworks.com>, Ralf Baechle <ralf@linux-mips.org>, Maneesh Soni <manesoni@cisco.com>, yrl.pp-manager.tt@hitachi.com, systemtap@sourceware.org
In-reply-to: <20130522093409.9084.63554.stgit@mhiramat-M0-7522>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20130522093409.9084.63554.stgit@mhiramat-M0-7522>
Sender: linux-mips-bounce@linux-mips.org
User-agent: StGit/0.15
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: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: Maneesh Soni <manesoni@cisco.com>
Cc: Victor Kamensky <kamensky@cisco.com>
Cc: linux-mips@linux-mips.org
---
 arch/mips/kernel/kprobes.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c
index 12bc4eb..1f8187a 100644
--- a/arch/mips/kernel/kprobes.c
+++ b/arch/mips/kernel/kprobes.c
@@ -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)


<Prev in Thread] Current Thread [Next in Thread>