linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing: Kill the unbalanced tr->ref++ in tracing_buffers_open()
@ 2013-07-19 15:36 Oleg Nesterov
  0 siblings, 0 replies; only message in thread
From: Oleg Nesterov @ 2013-07-19 15:36 UTC (permalink / raw)
  To: Ingo Molnar, Steven Rostedt
  Cc: Frederic Weisbecker, Masami Hiramatsu, linux-kernel

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

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/trace/trace.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index ee471fb..278c5f5 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4944,8 +4944,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.5.5.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-19 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-19 15:36 [PATCH] tracing: Kill the unbalanced tr->ref++ in tracing_buffers_open() Oleg Nesterov

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).