mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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: 80a76994b2 ("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>
			
			
This commit is contained in:
		
							parent
							
								
									1be8e54a1e
								
							
						
					
					
						commit
						0a8f11f856
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -1042,11 +1042,12 @@ enum print_line_t print_event_fields(struct trace_iterator *iter,
 | 
				
			||||||
	struct trace_event_call *call;
 | 
						struct trace_event_call *call;
 | 
				
			||||||
	struct list_head *head;
 | 
						struct list_head *head;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						lockdep_assert_held_read(&trace_event_sem);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* ftrace defined events have separate call structures */
 | 
						/* ftrace defined events have separate call structures */
 | 
				
			||||||
	if (event->type <= __TRACE_LAST_TYPE) {
 | 
						if (event->type <= __TRACE_LAST_TYPE) {
 | 
				
			||||||
		bool found = false;
 | 
							bool found = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		down_read(&trace_event_sem);
 | 
					 | 
				
			||||||
		list_for_each_entry(call, &ftrace_events, list) {
 | 
							list_for_each_entry(call, &ftrace_events, list) {
 | 
				
			||||||
			if (call->event.type == event->type) {
 | 
								if (call->event.type == event->type) {
 | 
				
			||||||
				found = true;
 | 
									found = true;
 | 
				
			||||||
| 
						 | 
					@ -1056,7 +1057,6 @@ enum print_line_t print_event_fields(struct trace_iterator *iter,
 | 
				
			||||||
			if (call->event.type > __TRACE_LAST_TYPE)
 | 
								if (call->event.type > __TRACE_LAST_TYPE)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		up_read(&trace_event_sem);
 | 
					 | 
				
			||||||
		if (!found) {
 | 
							if (!found) {
 | 
				
			||||||
			trace_seq_printf(&iter->seq, "UNKNOWN TYPE %d\n", event->type);
 | 
								trace_seq_printf(&iter->seq, "UNKNOWN TYPE %d\n", event->type);
 | 
				
			||||||
			goto out;
 | 
								goto out;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue