Commit 11a241a3 authored by Steven Rostedt's avatar Steven Rostedt

tracing: add protection around modify trace event fields

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: default avatarSteven Rostedt <srostedt@redhat.com>
parent d20e3b03
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#define TRACE_SYSTEM "TRACE_SYSTEM" #define TRACE_SYSTEM "TRACE_SYSTEM"
static DEFINE_MUTEX(event_mutex);
#define events_for_each(event) \ #define events_for_each(event) \
for (event = __start_ftrace_events; \ for (event = __start_ftrace_events; \
(unsigned long)event < (unsigned long)__stop_ftrace_events; \ (unsigned long)event < (unsigned long)__stop_ftrace_events; \
...@@ -104,6 +106,7 @@ static int ftrace_set_clr_event(char *buf, int set) ...@@ -104,6 +106,7 @@ static int ftrace_set_clr_event(char *buf, int set)
event = NULL; event = NULL;
} }
mutex_lock(&event_mutex);
events_for_each(call) { events_for_each(call) {
if (!call->name) if (!call->name)
...@@ -124,6 +127,8 @@ static int ftrace_set_clr_event(char *buf, int set) ...@@ -124,6 +127,8 @@ static int ftrace_set_clr_event(char *buf, int set)
ret = 0; ret = 0;
} }
mutex_unlock(&event_mutex);
return ret; return ret;
} }
...@@ -324,7 +329,9 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt, ...@@ -324,7 +329,9 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
switch (val) { switch (val) {
case 0: case 0:
case 1: case 1:
mutex_lock(&event_mutex);
ftrace_event_enable_disable(call, val); ftrace_event_enable_disable(call, val);
mutex_unlock(&event_mutex);
break; break;
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment