public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Oleg Nesterov <oleg@redhat.com>, Ingo Molnar <mingo@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	<stable@vger.kernel.org>
Subject: [PATCH 14/14] tracing: Kill the unbalanced tr->ref++ in tracing_buffers_open()
Date: Mon, 22 Jul 2013 10:20:01 -0400	[thread overview]
Message-ID: <20130722142126.542426716@goodmis.org> (raw)
In-Reply-To: 20130722141947.972915744@goodmis.org

[-- Attachment #1: 0014-tracing-Kill-the-unbalanced-tr-ref-in-tracing_buffer.patch --]
[-- Type: text/plain, Size: 1194 bytes --]

From: Oleg Nesterov <oleg@redhat.com>

tracing_buffers_open() does trace_array_get() and then it wrongly
inrcements tr->ref again under trace_types_lock. This means that
every caller leaks trace_array:

	# cd /sys/kernel/debug/tracing/
	# mkdir instances/X
	# true < instances/X/per_cpu/cpu0/trace_pipe_raw
	# rmdir instances/X
	rmdir: failed to remove `instances/X': Device or resource busy

Link: http://lkml.kernel.org/r/20130719153644.GA18899@redhat.com

Cc: Ingo Molnar <mingo@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: stable@vger.kernel.org # 3.10
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7d9ceab..3f24777 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4959,8 +4959,6 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)
 
 	mutex_lock(&trace_types_lock);
 
-	tr->ref++;
-
 	info->iter.tr		= tr;
 	info->iter.cpu_file	= tc->cpu;
 	info->iter.trace	= tr->current_trace;
-- 
1.7.10.4



      parent reply	other threads:[~2013-07-22 14:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-22 14:19 [PATCH 00/14] [GIT PULL] tracing: fixes, clean ups and optimizations Steven Rostedt
2013-07-22 14:19 ` [PATCH 01/14] tracing: Use correct config guard CONFIG_STACK_TRACER Steven Rostedt
2013-07-22 14:19 ` [PATCH 02/14] tracing: Use trace_seq_puts()/trace_seq_putc() where possible Steven Rostedt
2013-07-22 14:19 ` [PATCH 03/14] tracing: Typo fix on ring buffer comments Steven Rostedt
2013-07-22 14:19 ` [PATCH 04/14] tracing/function: Avoid perf_trace_buf_*() if event_function.perf_events is empty Steven Rostedt
2013-07-22 14:19 ` [PATCH 05/14] tracing/syscall: Avoid perf_trace_buf_*() if sys_data->perf_events " Steven Rostedt
2013-07-22 14:19 ` [PATCH 06/14] tracing/perf: Move the PERF_MAX_TRACE_SIZE check into perf_trace_buf_prepare() Steven Rostedt
2013-07-22 14:19 ` [PATCH 07/14] tracing/kprobe: Wait for disabling all running kprobe handlers Steven Rostedt
2013-07-22 14:19 ` [PATCH 08/14] tracing: Fix error handling to ensure instances can always be removed Steven Rostedt
2013-07-22 14:19 ` [PATCH 09/14] tracing: Miscellaneous fixes for trace_array ref counting Steven Rostedt
2013-07-22 14:19 ` [PATCH 10/14] tracing: Add ref_data to function and fgraph tracer structs Steven Rostedt
2013-07-22 14:19 ` [PATCH 11/14] tracing: Simplify the iteration logic in f_start/f_next Steven Rostedt
2013-07-22 14:19 ` [PATCH 12/14] tracing: Do not (ab)use trace_seq in event_id_read() Steven Rostedt
2013-07-22 14:20 ` [PATCH 13/14] tracing: Kill trace_array->waiter Steven Rostedt
2013-07-22 14:20 ` Steven Rostedt [this message]

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=20130722142126.542426716@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.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