aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-12 11:33:20 -0400
committerSteven Rostedt <srostedt@redhat.com>2009-03-12 21:14:58 -0400
commit1027fcb206a0fb8348e63aff078c74bdee1c2698 (patch)
tree05e858e410fdb30865a11c78e2bb9bb0a12f55ba /kernel/trace/trace.c
parenta123c52b46a1f84bcec3dc963351896c6d6afaf7 (diff)
tracing: protect ring_buffer_expanded with trace_types_lock
Impact: prevent races with ring_buffer_expanded This patch places the expanding of the tracing buffer under the protection of the trace_types_lock mutex. It is highly unlikely that there would be any contention, but better safe than sorry. Reported-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c61ee85c50bb..04ab8243a13d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2391,8 +2391,10 @@ int tracing_update_buffers(void)
2391{ 2391{
2392 int ret = 0; 2392 int ret = 0;
2393 2393
2394 mutex_lock(&trace_types_lock);
2394 if (!ring_buffer_expanded) 2395 if (!ring_buffer_expanded)
2395 ret = tracing_resize_ring_buffer(trace_buf_size); 2396 ret = tracing_resize_ring_buffer(trace_buf_size);
2397 mutex_unlock(&trace_types_lock);
2396 2398
2397 return ret; 2399 return ret;
2398} 2400}
@@ -2412,6 +2414,8 @@ static int tracing_set_tracer(const char *buf)
2412 struct tracer *t; 2414 struct tracer *t;
2413 int ret = 0; 2415 int ret = 0;
2414 2416
2417 mutex_lock(&trace_types_lock);
2418
2415 if (!ring_buffer_expanded) { 2419 if (!ring_buffer_expanded) {
2416 ret = tracing_resize_ring_buffer(trace_buf_size); 2420 ret = tracing_resize_ring_buffer(trace_buf_size);
2417 if (ret < 0) 2421 if (ret < 0)
@@ -2419,7 +2423,6 @@ static int tracing_set_tracer(const char *buf)
2419 ret = 0; 2423 ret = 0;
2420 } 2424 }
2421 2425
2422 mutex_lock(&trace_types_lock);
2423 for (t = trace_types; t; t = t->next) { 2426 for (t = trace_types; t; t = t->next) {
2424 if (strcmp(t->name, buf) == 0) 2427 if (strcmp(t->name, buf) == 0)
2425 break; 2428 break;