mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Namhyung Kim <namhyung.kim@lge.com>
Subject: Re: [PATCH 3/3] tracing: Check cpu file on tracing_release()
Date: Tue, 09 Apr 2013 20:31:03 -0400	[thread overview]
Message-ID: <1365553863.25498.84.camel@gandalf.local.home> (raw)
In-Reply-To: <1365553093-10180-3-git-send-email-namhyung@kernel.org>

On Wed, 2013-04-10 at 09:18 +0900, Namhyung Kim wrote:
> 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])

Only the cpu that is assigned gets buffer_iter[cpu] set. The other
buffer_iter[cpus] will simply be ignored.

-- Steve

> +				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]);
>  	}



  reply	other threads:[~2013-04-10  0:31 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 ` [PATCH 3/3] tracing: Check cpu file on tracing_release() Namhyung Kim
2013-04-10  0:31   ` Steven Rostedt [this message]
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=1365553863.25498.84.camel@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung.kim@lge.com \
    --cc=namhyung@kernel.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

all inboxes | Powered by JetHome®