Skip to content

Commit 4a621e2

Browse files
committed
Merge tag 'trace-v6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fixes from Steven Rostedt: "A couple of fixes for tracing: - Prevent a NULL pointer dereference in the error path of RTLA tool - Fix an infinite loop bug when reading from the ring buffer when closed. If there's a thread trying to read the ring buffer and it gets closed by another thread, the one reading will go into an infinite loop when the buffer is empty instead of exiting back to user space" * tag 'trace-v6.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: rtla/osnoise: Prevent NULL dereference in error handling tracing: Return from tracing_buffers_read() if the file has been closed
2 parents 1486141 + 90574d2 commit 4a621e2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

kernel/trace/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7956,7 +7956,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
79567956
trace_access_unlock(iter->cpu_file);
79577957

79587958
if (ret < 0) {
7959-
if (trace_empty(iter)) {
7959+
if (trace_empty(iter) && !iter->closed) {
79607960
if ((filp->f_flags & O_NONBLOCK))
79617961
return -EAGAIN;
79627962

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -651,20 +651,17 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params)
651651
return NULL;
652652

653653
tool->data = osnoise_alloc_top(nr_cpus);
654-
if (!tool->data)
655-
goto out_err;
654+
if (!tool->data) {
655+
osnoise_destroy_tool(tool);
656+
return NULL;
657+
}
656658

657659
tool->params = params;
658660

659661
tep_register_event_handler(tool->trace.tep, -1, "ftrace", "osnoise",
660662
osnoise_top_handler, NULL);
661663

662664
return tool;
663-
664-
out_err:
665-
osnoise_free_top(tool->data);
666-
osnoise_destroy_tool(tool);
667-
return NULL;
668665
}
669666

670667
static int stop_tracing;

0 commit comments

Comments
 (0)