Skip to content

Commit 152a063

Browse files
tracing: Do not take trace_event_sem in print_event_fields()
JIRA: https://issues.redhat.com/browse/RHEL-115358 commit 0a8f11f Author: Steven Rostedt <rostedt@goodmis.org> Date: Thu May 1 22:41:28 2025 -0400 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: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/20250501224128.0b1f0571@batman.local.home Fixes: 80a7699 ("tracing: Add "fields" option to show raw trace event fields") Reported-by: syzbot+441582c1592938fccf09@syzkaller.appspotmail.com Closes: https://lore.kernel.org/all/6813ff5e.050a0220.14dd7d.001b.GAE@google.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
1 parent ecf858b commit 152a063

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
@@ -961,11 +961,12 @@ enum print_line_t print_event_fields(struct trace_iterator *iter,
961961
struct trace_event_call *call;
962962
struct list_head *head;
963963

964+
lockdep_assert_held_read(&trace_event_sem);
965+
964966
/* ftrace defined events have separate call structures */
965967
if (event->type <= __TRACE_LAST_TYPE) {
966968
bool found = false;
967969

968-
down_read(&trace_event_sem);
969970
list_for_each_entry(call, &ftrace_events, list) {
970971
if (call->event.type == event->type) {
971972
found = true;
@@ -975,7 +976,6 @@ enum print_line_t print_event_fields(struct trace_iterator *iter,
975976
if (call->event.type > __TRACE_LAST_TYPE)
976977
break;
977978
}
978-
up_read(&trace_event_sem);
979979
if (!found) {
980980
trace_seq_printf(&iter->seq, "UNKNOWN TYPE %d\n", event->type);
981981
goto out;

0 commit comments

Comments
 (0)