From: Masami Hiramatsu <mhiramat@redhat.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] trace_kprobes: fix memory leak
Date: Wed, 25 Nov 2009 07:42:07 -0500 [thread overview]
Message-ID: <4B0D261F.7050300@redhat.com> (raw)
In-Reply-To: <4B0CEB95.2060107@cn.fujitsu.com>
Hi Lai,
Thank you for fixing bugs!
Acked-by: Masami Hiramatsu <mhiramat@redhat.com>
Lai Jiangshan wrote:
>
> tp->nr_args is not set before we "goto error",
> it causes memory leak for free_trace_probe() use tp->nr_args
> to free memory of args.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
> ---
> diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> index 79ce6a2..82e8583 100644
> --- a/kernel/trace/trace_kprobe.c
> +++ b/kernel/trace/trace_kprobe.c
> @@ -704,10 +704,12 @@ static int create_trace_probe(int argc, char **argv)
> ret = parse_probe_arg(arg, &tp->args[i].fetch, 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++;
> }
> - tp->nr_args = i;
>
> ret = register_trace_probe(tp);
> if (ret)
>
>
--
Masami Hiramatsu
Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division
e-mail: mhiramat@redhat.com
next prev parent reply other threads:[~2009-11-25 12:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 8:32 [PATCH 1/3] trace_kprobes: fix memory leak Lai Jiangshan
2009-11-25 12:42 ` Masami Hiramatsu [this message]
2009-11-27 5:49 ` [tip:perf/core] trace_kprobes: Fix " tip-bot for Lai Jiangshan
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=4B0D261F.7050300@redhat.com \
--to=mhiramat@redhat.com \
--cc=fweisbec@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/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