]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Fix NULL pointer dereference in start_creating
authorKamal Agrawal <kamaagra@codeaurora.org>
Fri, 30 Jul 2021 13:23:06 +0000 (18:53 +0530)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 30 Jul 2021 22:45:11 +0000 (18:45 -0400)
commit2d411f24a617e8bf1faab772205091a353a7678e
treede57fd79d18c741483ed2d60d31048d3f0ed082b
parent6f982bba6883f5172c977d76d7bd50de88762682
tracing: Fix NULL pointer dereference in start_creating

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: 9742dbb6ef88 ("tracing: Enable creating new instance early boot")
Signed-off-by: Kamal Agrawal <kamaagra@codeaurora.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace.c