aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-09-22 01:52:57 -0400
committerIngo Molnar <mingo@elte.hu>2009-09-22 04:28:56 -0400
commit1eb90f138b3fb4cc15f3acec94aa788e846269f7 (patch)
treed5e361214065598094d9b4ec71b3591edeaa74e5 /kernel/trace
parent4ba7978e98a3ff92cebfb0f31a02c309e3ffa1fe (diff)
tracing: Fix failure path in ftrace_graph_write()
Don't call trace_parser_put() on uninitialized trace_parser. Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <4AB86639.3000003@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index a8fe4782ebad..5c5cb9be8e8c 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,
2561 2561
2562 if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { 2562 if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) {
2563 ret = -EBUSY; 2563 ret = -EBUSY;
2564 goto out; 2564 goto out_unlock;
2565 } 2565 }
2566 2566
2567 if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { 2567 if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) {
2568 ret = -ENOMEM; 2568 ret = -ENOMEM;
2569 goto out; 2569 goto out_unlock;
2570 } 2570 }
2571 2571
2572 read = trace_get_user(&parser, ubuf, cnt, ppos); 2572 read = trace_get_user(&parser, ubuf, cnt, ppos);
@@ -2578,12 +2578,14 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
2578 ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, 2578 ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count,
2579 parser.buffer); 2579 parser.buffer);
2580 if (ret) 2580 if (ret)
2581 goto out; 2581 goto out_free;
2582 } 2582 }
2583 2583
2584 ret = read; 2584 ret = read;
2585 out: 2585
2586out_free:
2586 trace_parser_put(&parser); 2587 trace_parser_put(&parser);
2588out_unlock:
2587 mutex_unlock(&graph_lock); 2589 mutex_unlock(&graph_lock);
2588 2590
2589 return ret; 2591 return ret;