tracing: Check return value of tracing_dentry_percpu()
authorNamhyung Kim <namhyung.kim@lge.com>
Mon, 23 Apr 2012 01:11:57 +0000 (10:11 +0900)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 16 May 2012 23:50:37 +0000 (19:50 -0400)
If tracing_dentry_percpu() failed, tracing_init_debugfs_percpu()
will try to create each cpu directories on debugfs' root directory
as d_percpu is NULL.

Link: http://lkml.kernel.org/r/1335143517-2285-1-git-send-email-namhyung.kim@lge.com
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.c

index dfbd86cc4876d2ad1e323842bdd3192e5e54e9cb..0ed4df0c6a39fd8c507a79f95a0e87fbccd3d34a 100644 (file)
@@ -4474,6 +4474,9 @@ static void tracing_init_debugfs_percpu(long cpu)
        struct dentry *d_cpu;
        char cpu_dir[30]; /* 30 characters should be more than enough */
 
+       if (!d_percpu)
+               return;
+
        snprintf(cpu_dir, 30, "cpu%ld", cpu);
        d_cpu = debugfs_create_dir(cpu_dir, d_percpu);
        if (!d_cpu) {