aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-07-22 23:29:11 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-07-23 09:53:23 -0400
commit87827111a5538633b18e5c641ced673c4c2bb6ce (patch)
tree46249db51a7f94e31948f48b07efbbbc5de3e7c3 /kernel/trace/ftrace.c
parentd8cc1ab793993c886c62abf77c93287df33ffd8b (diff)
function-graph: Fix seqfile memory leak
Every time we cat set_graph_function, we leak memory allocated by seq_open(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> LKML-Reference: <4A67D907.2010500@cn.fujitsu.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4521c77d1a1a..1f3ec2afa511 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2596,6 +2596,14 @@ ftrace_graph_open(struct inode *inode, struct file *file)
2596} 2596}
2597 2597
2598static int 2598static int
2599ftrace_graph_release(struct inode *inode, struct file *file)
2600{
2601 if (file->f_mode & FMODE_READ)
2602 seq_release(inode, file);
2603 return 0;
2604}
2605
2606static int
2599ftrace_set_func(unsigned long *array, int *idx, char *buffer) 2607ftrace_set_func(unsigned long *array, int *idx, char *buffer)
2600{ 2608{
2601 struct dyn_ftrace *rec; 2609 struct dyn_ftrace *rec;
@@ -2724,9 +2732,10 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
2724} 2732}
2725 2733
2726static const struct file_operations ftrace_graph_fops = { 2734static const struct file_operations ftrace_graph_fops = {
2727 .open = ftrace_graph_open, 2735 .open = ftrace_graph_open,
2728 .read = seq_read, 2736 .read = seq_read,
2729 .write = ftrace_graph_write, 2737 .write = ftrace_graph_write,
2738 .release = ftrace_graph_release,
2730}; 2739};
2731#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 2740#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
2732 2741