Skip to content

Commit 4fead8e

Browse files
Masami Hiramatsufweisbec
authored andcommitted
ftrace: Fix trace_remove_event_call() to lock trace_event_mutex
Lock not only event_mutex but also trace_event_mutex in trace_remove_event_call() to protect __unregister_ftrace_event(). Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Jim Keniston <jkenisto@us.ibm.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Frank Ch. Eigler <fche@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jason Baron <jbaron@redhat.com> Cc: K.Prasad <prasad@linux.vnet.ibm.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <20090914204912.18779.68734.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
1 parent 588bebb commit 4fead8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/trace/trace_events.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,9 @@ static void remove_subsystem_dir(const char *name)
10541054
}
10551055
}
10561056

1057+
/*
1058+
* Must be called under locking both of event_mutex and trace_event_mutex.
1059+
*/
10571060
static void __trace_remove_event_call(struct ftrace_event_call *call)
10581061
{
10591062
ftrace_event_enable_disable(call, 0);
@@ -1070,7 +1073,9 @@ static void __trace_remove_event_call(struct ftrace_event_call *call)
10701073
void trace_remove_event_call(struct ftrace_event_call *call)
10711074
{
10721075
mutex_lock(&event_mutex);
1076+
down_write(&trace_event_mutex);
10731077
__trace_remove_event_call(call);
1078+
up_write(&trace_event_mutex);
10741079
mutex_unlock(&event_mutex);
10751080
}
10761081

0 commit comments

Comments
 (0)