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 <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Jim Keniston <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Frank Ch. Eigler <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jason Baron <[email protected]> Cc: K.Prasad <[email protected]> Cc: Lai Jiangshan <[email protected]> Cc: Li Zefan <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Srikar Dronamraju <[email protected]> Cc: Tom Zanussi <[email protected]> LKML-Reference: <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
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)