Thread (10 messages) 10 messages, 4 authors, 2025-09-11

Re: [PATCH] tracing: Fix missing errno when zero parser->idx in trace_pid_write

flat view

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2025-09-05 19:38:50
Also in: lkml

On Wed, 3 Sep 2025 12:15:16 +0800
Pu Lehui [off-list ref] wrote:
As for this fault injection syzkaller issue, shall we need to silence 
it? How about the below fix?
I usually don't care about fault injections because it causes "faults" that
would only happen if the system was about to crash. But anyway..
quoted hunk ↗ jump to hunk
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index e6b50b416e63..c17c031e7917 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -834,7 +834,11 @@ int trace_pid_write(struct trace_pid_list 
*filtered_pids,
                 /* copy the current bits to the new max */
                 ret = trace_pid_list_first(filtered_pids, &pid);
                 while (!ret) {
-                       trace_pid_list_set(pid_list, pid);
+                       ret = trace_pid_list_set(pid_list, pid);
+                       if (ret) {
+                               trace_parser_put(&parser);
+                               return ret;
+                       }
make it:

			if (ret < 0)
				goto out;
                         ret = trace_pid_list_next(filtered_pids, pid + 
1, &pid);
                         nr_pids++;
                 }
And put the out label just before the trace_parser_put().

Oh, and add one space before the "out:" label. That makes diffs of patches
show the function when changes are after the label and not the label itself.

-- Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help