From: Li Zefan <lizf@cn.fujitsu.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@elte.hu>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] tracing: fix failure path in ftrace_graph_write()
Date: Tue, 22 Sep 2009 13:52:57 +0800 [thread overview]
Message-ID: <4AB86639.3000003@cn.fujitsu.com> (raw)
In-Reply-To: <4AB865FA.5080801@cn.fujitsu.com>
Don't call trace_parser_put() on uninitialized trace_parser.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
kernel/trace/ftrace.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a8fe478..5c5cb9b 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2561,12 +2561,12 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) {
ret = -EBUSY;
- goto out;
+ goto out_unlock;
}
if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) {
ret = -ENOMEM;
- goto out;
+ goto out_unlock;
}
read = trace_get_user(&parser, ubuf, cnt, ppos);
@@ -2578,12 +2578,14 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count,
parser.buffer);
if (ret)
- goto out;
+ goto out_free;
}
ret = read;
- out:
+
+out_free:
trace_parser_put(&parser);
+out_unlock:
mutex_unlock(&graph_lock);
return ret;
--
1.6.3
next prev parent reply other threads:[~2009-09-22 5:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-22 5:51 [PATCH 1/4] tracing: fix off-by-one in trace_get_user() Li Zefan
2009-09-22 5:52 ` [PATCH 2/4] tracing: check the return value of trace_get_user() Li Zefan
2009-09-22 8:39 ` [tip:tracing/urgent] tracing: Check " tip-bot for Li Zefan
2009-09-22 5:52 ` Li Zefan [this message]
2009-09-22 8:40 ` [tip:tracing/urgent] tracing: Fix failure path in ftrace_graph_write() tip-bot for Li Zefan
2009-09-22 5:54 ` [PATCH 4/4] tracing: fix failure path in ftrace_regex_open() Li Zefan
2009-09-22 8:40 ` [tip:tracing/urgent] tracing: Fix " tip-bot for Li Zefan
2009-09-22 8:39 ` [tip:tracing/urgent] tracing: Fix off-by-one in trace_get_user() tip-bot for Li Zefan
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=4AB86639.3000003@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=jolsa@redhat.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