public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Li Zefan <lizf@cn.fujitsu.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	rostedt@goodmis.org, lizf@cn.fujitsu.com, tglx@linutronix.de
Subject: [tip:tracing/urgent] function-graph: Fix seqfile memory leak
Date: Thu, 30 Jul 2009 19:55:13 GMT	[thread overview]
Message-ID: <tip-87827111a5538633b18e5c641ced673c4c2bb6ce@git.kernel.org> (raw)
In-Reply-To: <4A67D907.2010500@cn.fujitsu.com>

Commit-ID:  87827111a5538633b18e5c641ced673c4c2bb6ce
Gitweb:     http://git.kernel.org/tip/87827111a5538633b18e5c641ced673c4c2bb6ce
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Thu, 23 Jul 2009 11:29:11 +0800
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Thu, 23 Jul 2009 09:53:23 -0400

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>


---
 kernel/trace/ftrace.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4521c77..1f3ec2a 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2596,6 +2596,14 @@ ftrace_graph_open(struct inode *inode, struct file *file)
 }
 
 static int
+ftrace_graph_release(struct inode *inode, struct file *file)
+{
+	if (file->f_mode & FMODE_READ)
+		seq_release(inode, file);
+	return 0;
+}
+
+static int
 ftrace_set_func(unsigned long *array, int *idx, char *buffer)
 {
 	struct dyn_ftrace *rec;
@@ -2724,9 +2732,10 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
 }
 
 static const struct file_operations ftrace_graph_fops = {
-	.open = ftrace_graph_open,
-	.read = seq_read,
-	.write = ftrace_graph_write,
+	.open		= ftrace_graph_open,
+	.read		= seq_read,
+	.write		= ftrace_graph_write,
+	.release	= ftrace_graph_release,
 };
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
 

  reply	other threads:[~2009-07-30 19:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23  3:28 [PATCH 0/3] tracing: Fix seqfile memory leak for .31 Li Zefan
2009-07-23  3:28 ` [PATCH 1/3] trace_stack: Fix seqfile memory leak Li Zefan
2009-07-30 19:54   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-07-23  3:29 ` [PATCH 2/3] function-graph: " Li Zefan
2009-07-30 19:55   ` tip-bot for Li Zefan [this message]
2009-07-23  3:29 ` [PATCH 3/3] tracing/stat: " Li Zefan
2009-07-30 19:55   ` [tip:tracing/urgent] " tip-bot for Li Zefan
2009-07-23  3:44 ` [PATCH 0/3] tracing: Fix seqfile memory leak for .31 Steven Rostedt

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-87827111a5538633b18e5c641ced673c4c2bb6ce@git.kernel.org \
    --to=lizf@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --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