From: tip-bot for Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@redhat.com, mathieu.desnoyers@efficios.com,
masami.hiramatsu.pt@hitachi.com, fweisbec@gmail.com,
rostedt@goodmis.org, tglx@linutronix.de
Subject: [tip:perf/core] tracing/kprobe: Fix a memory leak in error case
Date: Thu, 9 Sep 2010 19:43:12 GMT [thread overview]
Message-ID: <tip-61a527362234ac3352a91ac67c50c6f7cd248eb1@git.kernel.org> (raw)
In-Reply-To: <20100827113846.22882.12670.stgit@ltc236.sdl.hitachi.co.jp>
Commit-ID: 61a527362234ac3352a91ac67c50c6f7cd248eb1
Gitweb: http://git.kernel.org/tip/61a527362234ac3352a91ac67c50c6f7cd248eb1
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Fri, 27 Aug 2010 20:38:46 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 8 Sep 2010 11:47:18 -0300
tracing/kprobe: Fix a memory leak in error case
Fix a memory leak which happens when a field name conflicts with others. In
error case, free_trace_probe() will free all arguments until nr_args, so this
increments nr_args the begining of the loop instead of the end.
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
LKML-Reference: <20100827113846.22882.12670.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
kernel/trace/trace_kprobe.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 8b27c98..0116c03 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -992,6 +992,9 @@ static int create_trace_probe(int argc, char **argv)
/* parse arguments */
ret = 0;
for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
+ /* Increment count for freeing args in error case */
+ tp->nr_args++;
+
/* Parse argument name */
arg = strchr(argv[i], '=');
if (arg)
@@ -1021,11 +1024,8 @@ static int create_trace_probe(int argc, char **argv)
ret = parse_probe_arg(arg, tp, &tp->args[i], is_return);
if (ret) {
pr_info("Parse error at argument%d. (%d)\n", i, ret);
- kfree(tp->args[i].name);
goto error;
}
-
- tp->nr_args++;
}
ret = register_trace_probe(tp);
next prev parent reply other threads:[~2010-09-09 19:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 11:38 [PATCH -tip 0/5] Perf and tracing/kprobe fixes Masami Hiramatsu
2010-08-27 11:38 ` [PATCH -tip 1/5] tracing/kprobe: Fix a memory leak in error case Masami Hiramatsu
2010-09-09 19:43 ` tip-bot for Masami Hiramatsu [this message]
2010-08-27 11:38 ` [PATCH -tip 2/5] perf probe: Fix return probe support Masami Hiramatsu
2010-09-09 19:43 ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2010-08-27 11:38 ` [PATCH -tip 3/5] perf probe: Don't make argument names from raw parameters Masami Hiramatsu
2010-09-09 19:43 ` [tip:perf/core] perf probe: Fix handling of arguments names tip-bot for Masami Hiramatsu
2010-08-27 11:39 ` [PATCH -tip 4/5] tracing/kprobes: Set a name for each argument automatically Masami Hiramatsu
2010-09-09 19:44 ` [tip:perf/core] tracing/kprobes: Fix handling of argument names tip-bot for Masami Hiramatsu
2010-08-27 11:39 ` [PATCH -tip 5/5] tracing/kprobe: Check invalid argument name Masami Hiramatsu
2010-09-09 19:44 ` [tip:perf/core] tracing/kprobe: Fix handling of C-unlike argument names tip-bot for Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-61a527362234ac3352a91ac67c50c6f7cd248eb1@git.kernel.org \
--to=masami.hiramatsu.pt@hitachi.com \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome