Skip to content

Commit a541641

Browse files
toyookarostedt
authored andcommitted
tracing: Add checks if tr->buffer is NULL in tracing_reset{_online_cpus}
max_tr->buffer could be NULL in the tracing_reset{_online_cpus}. In this case, a NULL pointer dereference happens, so we should return immediately from these functions. Note, the current code does not call tracing_reset*() with max_tr when its buffer is NULL, but future code will. This patch is needed to prevent the future code from crashing. Link: http://lkml.kernel.org/r/20121219070234.31200.93863.stgit@liselsia Signed-off-by: Hiraku Toyooka <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 6aea49c commit a541641

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

kernel/trace/trace.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,9 @@ void tracing_reset(struct trace_array *tr, int cpu)
922922
{
923923
struct ring_buffer *buffer = tr->buffer;
924924

925+
if (!buffer)
926+
return;
927+
925928
ring_buffer_record_disable(buffer);
926929

927930
/* Make sure all commits have finished */
@@ -936,6 +939,9 @@ void tracing_reset_online_cpus(struct trace_array *tr)
936939
struct ring_buffer *buffer = tr->buffer;
937940
int cpu;
938941

942+
if (!buffer)
943+
return;
944+
939945
ring_buffer_record_disable(buffer);
940946

941947
/* Make sure all commits have finished */

0 commit comments

Comments
 (0)