Skip to content

Commit 0a8f11f

Browse files
committed
tracing: Do not take trace_event_sem in print_event_fields()
On some paths in print_event_fields() it takes the trace_event_sem for read, even though it should always be held when the function is called. Remove the taking of that mutex and add a lockdep_assert_held_read() to make sure the trace_event_sem is held when print_event_fields() is called. Cc: [email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 80a7699 ("tracing: Add "fields" option to show raw trace event fields") Reported-by: [email protected] Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 1be8e54 commit 0a8f11f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace_output.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,11 +1042,12 @@ enum print_line_t print_event_fields(struct trace_iterator *iter,
10421042
struct trace_event_call *call;
10431043
struct list_head *head;
10441044

1045+
lockdep_assert_held_read(&trace_event_sem);
1046+
10451047
/* ftrace defined events have separate call structures */
10461048
if (event->type <= __TRACE_LAST_TYPE) {
10471049
bool found = false;
10481050

1049-
down_read(&trace_event_sem);
10501051
list_for_each_entry(call, &ftrace_events, list) {
10511052
if (call->event.type == event->type) {
10521053
found = true;
@@ -1056,7 +1057,6 @@ enum print_line_t print_event_fields(struct trace_iterator *iter,
10561057
if (call->event.type > __TRACE_LAST_TYPE)
10571058
break;
10581059
}
1059-
up_read(&trace_event_sem);
10601060
if (!found) {
10611061
trace_seq_printf(&iter->seq, "UNKNOWN TYPE %d\n", event->type);
10621062
goto out;

0 commit comments

Comments
 (0)