Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755830Ab3EVJhN (ORCPT ); Wed, 22 May 2013 05:37:13 -0400 Received: from mail7.hitachi.co.jp ([133.145.228.42]:60546 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755732Ab3EVJhE (ORCPT ); Wed, 22 May 2013 05:37:04 -0400 X-AuditID: 85900ec0-d4ccab900000151e-db-519c91bdf9e5 Subject: [PATCH 2/2] [BUGFIX] kprobes/mips: Fix to check double free of insn slot To: Ingo Molnar , linux-kernel@vger.kernel.org From: Masami Hiramatsu Cc: linux-mips@linux-mips.org, Victor Kamensky , David Daney , Ralf Baechle , Maneesh Soni , yrl.pp-manager.tt@hitachi.com, systemtap@sourceware.org Date: Wed, 22 May 2013 18:34:13 +0900 Message-ID: <20130522093413.9084.33395.stgit@mhiramat-M0-7522> In-Reply-To: <20130522093409.9084.63554.stgit@mhiramat-M0-7522> References: <20130522093409.9084.63554.stgit@mhiramat-M0-7522> User-Agent: StGit/0.15 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1166 Lines: 35 Fix to check double free of insn_slot at arch_remove_kprobe as other arches do. Signed-off-by: Masami Hiramatsu Cc: Ralf Baechle Cc: David Daney Cc: Maneesh Soni Cc: Victor Kamensky 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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/