Skip to content

Commit

Permalink
tracing/ftrace: check if debugfs is registered before creating files
Browse files Browse the repository at this point in the history
Impact: fix a crash with ftrace={nop,boot} parameter

If the nop or initcall tracers are launched as boot tracers,
they will attempt to create their option directory and files.
But these tracers are registered very early and then assigned
as "boot tracers" very early if asked to.

Since they do this before debugfs has been registered (core initcall),
a crash is triggered.

Another early tracers could also come later. So we fix it by
checking if debugfs is initialized before creating the root
tracing directory.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1237759847-21025-3-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Frederic Weisbecker authored and Ingo Molnar committed Mar 23, 2009
1 parent c0f92ba commit 3e1f60b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3513,6 +3513,9 @@ struct dentry *tracing_init_dentry(void)
if (d_tracer)
return d_tracer;

if (!debugfs_initialized())
return NULL;

d_tracer = debugfs_create_dir("tracing", NULL);

if (!d_tracer && !once) {
Expand Down

0 comments on commit 3e1f60b

Please sign in to comment.