Commit 4a621e29 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 1486141a 90574d2a
...@@ -7956,7 +7956,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf, ...@@ -7956,7 +7956,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
trace_access_unlock(iter->cpu_file); trace_access_unlock(iter->cpu_file);
if (ret < 0) { if (ret < 0) {
if (trace_empty(iter)) { if (trace_empty(iter) && !iter->closed) {
if ((filp->f_flags & O_NONBLOCK)) if ((filp->f_flags & O_NONBLOCK))
return -EAGAIN; return -EAGAIN;
......
...@@ -651,8 +651,10 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params) ...@@ -651,8 +651,10 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params)
return NULL; return NULL;
tool->data = osnoise_alloc_top(nr_cpus); tool->data = osnoise_alloc_top(nr_cpus);
if (!tool->data) if (!tool->data) {
goto out_err; osnoise_destroy_tool(tool);
return NULL;
}
tool->params = params; tool->params = params;
...@@ -660,11 +662,6 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params) ...@@ -660,11 +662,6 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params)
osnoise_top_handler, NULL); osnoise_top_handler, NULL);
return tool; return tool;
out_err:
osnoise_free_top(tool->data);
osnoise_destroy_tool(tool);
return NULL;
} }
static int stop_tracing; static int stop_tracing;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment