Skip to content

Commit 1483ce6

Browse files
Kamal Agrawalgregkh
authored andcommitted
tracing: Fix NULL pointer dereference in start_creating
commit ff41c28 upstream. The event_trace_add_tracer() can fail. In this case, it leads to a crash in start_creating with below call stack. Handle the error scenario properly in trace_array_create_dir. Call trace: down_write+0x7c/0x204 start_creating.25017+0x6c/0x194 tracefs_create_file+0xc4/0x2b4 init_tracer_tracefs+0x5c/0x940 trace_array_create_dir+0x58/0xb4 trace_array_create+0x1bc/0x2b8 trace_array_get_by_name+0xdc/0x18c Link: https://lkml.kernel.org/r/1627651386-21315-1-git-send-email-kamaagra@codeaurora.org Cc: stable@vger.kernel.org Fixes: 4114fbf ("tracing: Enable creating new instance early boot") Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent aa9876e commit 1483ce6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎kernel/trace/trace.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9006,8 +9006,10 @@ static int trace_array_create_dir(struct trace_array *tr)
90069006
return -EINVAL;
90079007

90089008
ret = event_trace_add_tracer(tr->dir, tr);
9009-
if (ret)
9009+
if (ret) {
90109010
tracefs_remove(tr->dir);
9011+
return ret;
9012+
}
90119013

90129014
init_tracer_tracefs(tr, tr->dir);
90139015
__update_tracer_options(tr);

0 commit comments

Comments
 (0)