The trace event objects are currently not proctected against
reentrancy. This patch adds a mutex around the modifications of
the trace event fields.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
 
 #define TRACE_SYSTEM "TRACE_SYSTEM"
 
+static DEFINE_MUTEX(event_mutex);
+
 #define events_for_each(event)                                         \
        for (event = __start_ftrace_events;                             \
             (unsigned long)event < (unsigned long)__stop_ftrace_events; \
                        event = NULL;
        }
 
+       mutex_lock(&event_mutex);
        events_for_each(call) {
 
                if (!call->name)
 
                ret = 0;
        }
+       mutex_unlock(&event_mutex);
+
        return ret;
 }
 
        switch (val) {
        case 0:
        case 1:
+               mutex_lock(&event_mutex);
                ftrace_event_enable_disable(call, val);
+               mutex_unlock(&event_mutex);
                break;
 
        default: