aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_events.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-02 11:49:04 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-03-02 11:49:04 -0500
commit11a241a3302277db05561e01477528629d806c4e (patch)
treec48e1bf3c52a94dfa27d301a748ed7d181fc65f9 /kernel/trace/trace_events.c
parentd20e3b03842bfeb9d21817ff19054c277cc3eac0 (diff)
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: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace_events.c')
-rw-r--r--kernel/trace/trace_events.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 1d07f800a9ce..26069fa6b3b0 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -14,6 +14,8 @@
14 14
15#define TRACE_SYSTEM "TRACE_SYSTEM" 15#define TRACE_SYSTEM "TRACE_SYSTEM"
16 16
17static DEFINE_MUTEX(event_mutex);
18
17#define events_for_each(event) \ 19#define events_for_each(event) \
18 for (event = __start_ftrace_events; \ 20 for (event = __start_ftrace_events; \
19 (unsigned long)event < (unsigned long)__stop_ftrace_events; \ 21 (unsigned long)event < (unsigned long)__stop_ftrace_events; \
@@ -104,6 +106,7 @@ static int ftrace_set_clr_event(char *buf, int set)
104 event = NULL; 106 event = NULL;
105 } 107 }
106 108
109 mutex_lock(&event_mutex);
107 events_for_each(call) { 110 events_for_each(call) {
108 111
109 if (!call->name) 112 if (!call->name)
@@ -124,6 +127,8 @@ static int ftrace_set_clr_event(char *buf, int set)
124 127
125 ret = 0; 128 ret = 0;
126 } 129 }
130 mutex_unlock(&event_mutex);
131
127 return ret; 132 return ret;
128} 133}
129 134
@@ -324,7 +329,9 @@ event_enable_write(struct file *filp, const char __user *ubuf, size_t cnt,
324 switch (val) { 329 switch (val) {
325 case 0: 330 case 0:
326 case 1: 331 case 1:
332 mutex_lock(&event_mutex);
327 ftrace_event_enable_disable(call, val); 333 ftrace_event_enable_disable(call, val);
334 mutex_unlock(&event_mutex);
328 break; 335 break;
329 336
330 default: 337 default: