]> Pileus Git - ~andy/linux/blobdiff - kernel/trace/trace_events.c
ftrace: Fix trace_remove_event_call() to lock trace_event_mutex
[~andy/linux] / kernel / trace / trace_events.c
index 83cc2c01195d7deafd577c9a0da3582da597c2ec..f85b0f1cb9425b627564fc666ac57864f59c3b64 100644 (file)
@@ -1054,6 +1054,9 @@ static void remove_subsystem_dir(const char *name)
        }
 }
 
+/*
+ * Must be called under locking both of event_mutex and trace_event_mutex.
+ */
 static void __trace_remove_event_call(struct ftrace_event_call *call)
 {
        ftrace_event_enable_disable(call, 0);
@@ -1070,7 +1073,9 @@ static void __trace_remove_event_call(struct ftrace_event_call *call)
 void trace_remove_event_call(struct ftrace_event_call *call)
 {
        mutex_lock(&event_mutex);
+       down_write(&trace_event_mutex);
        __trace_remove_event_call(call);
+       up_write(&trace_event_mutex);
        mutex_unlock(&event_mutex);
 }