linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>
Subject: [PATCH 3/3] tracing: Check cpu file on tracing_release()
Date: Wed, 10 Apr 2013 09:18:13 +0900	[thread overview]
Message-ID: <1365553093-10180-3-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1365553093-10180-1-git-send-email-namhyung@kernel.org>

From: Namhyung Kim <namhyung.kim@lge.com>

It looks like tracing_release() lacks checking iter->cpu_file so that
closing a per_cpu trace file would attempt to close all cpu buffers.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 kernel/trace/trace.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7270460cfe3c..0beddcb80509 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2883,7 +2883,13 @@ static int tracing_release(struct inode *inode, struct file *file)
 	WARN_ON(!tr->ref);
 	tr->ref--;
 
-	for_each_tracing_cpu(cpu) {
+	if (iter->cpu_file == RING_BUFFER_ALL_CPUS) {
+		for_each_tracing_cpu(cpu) {
+			if (iter->buffer_iter[cpu])
+				ring_buffer_read_finish(iter->buffer_iter[cpu]);
+		}
+	} else {
+		cpu = iter->cpu_file;
 		if (iter->buffer_iter[cpu])
 			ring_buffer_read_finish(iter->buffer_iter[cpu]);
 	}
-- 
1.7.11.7


  parent reply	other threads:[~2013-04-10  0:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10  0:18 [PATCH 1/3] tracing: Get rid of unneeded key calculation in ftrace_hash_move() Namhyung Kim
2013-04-10  0:18 ` [PATCH 2/3] tracing: Check return value of tracing_init_dentry() Namhyung Kim
2013-04-10  0:18 ` Namhyung Kim [this message]
2013-04-10  0:31   ` [PATCH 3/3] tracing: Check cpu file on tracing_release() Steven Rostedt
2013-04-10  0:36     ` Namhyung Kim
2013-04-10  0:46       ` Steven Rostedt
2013-04-10  1:30         ` Namhyung Kim
2013-04-10  1:47           ` Steven Rostedt
2013-04-10  1:55             ` [PATCH] tracing: Check result of ring_buffer_read_prepare() Namhyung Kim
2013-04-13  3:00               ` 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=1365553093-10180-3-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung.kim@lge.com \
    --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;
as well as URLs for NNTP newsgroup(s).