tracing: Fix race between deleting buffer and setting events
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 2 Jul 2013 18:48:23 +0000 (14:48 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 3 Jul 2013 00:42:25 +0000 (20:42 -0400)
commit2a6c24afab70dbcfee49f4c76e1511eec1a3298b
treeea1f139f0f1192f4494a68166eb0ba36322a23de
parent8e2e2fa47129532a30cff6c25a47078dc97d9260
tracing: Fix race between deleting buffer and setting events

While analyzing the code, I discovered that there's a potential race between
deleting a trace instance and setting events. There are a few races that can
occur if events are being traced as the buffer is being deleted. Mostly the
problem comes with freeing the descriptor used by the trace event callback.
To prevent problems like this, the events are disabled before the buffer is
deleted. The problem with the current solution is that the event_mutex is let
go between disabling the events and freeing the files, which means that the events
could be enabled again while the freeing takes place.

Cc: stable@vger.kernel.org # 3.10
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_events.c