Skip to content

Commit

Permalink
ftrace: fix mutex unlock in trace output
Browse files Browse the repository at this point in the history
If the trace output changes on reading the trace files, there is a chance
that the start function will return NULL. If the start function of a sequence
returns NULL the stop equivalent is not called. In this case, all locks
that are taken must be released even if they are released in the stop function.

This patch fixes a case that a mutex was not released on return of NULL
in the start sequence function.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Steven Rostedt authored and Thomas Gleixner committed May 23, 2008
1 parent 07a267c commit d15f57f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,10 @@ static void *s_start(struct seq_file *m, loff_t *pos)

mutex_lock(&trace_types_lock);

if (!current_trace || current_trace != iter->trace)
if (!current_trace || current_trace != iter->trace) {
mutex_unlock(&trace_types_lock);
return NULL;
}

atomic_inc(&trace_record_cmdline_disabled);

Expand Down

0 comments on commit d15f57f

Please sign in to comment.