[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240816102305.08d91865@gandalf.local.home>
Date: Fri, 16 Aug 2024 10:23:05 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Masami Hiramatsu
<mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
John Kacur <jkacur@...hat.com>, Juri Lelli <juri.lelli@...il.com>, Dan
Carpenter <dan.carpenter@...aro.org>
Subject: [GIT PULL] tracing: Fixes in RTLA tool and reading the ring buffer
Linus,
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.
Please pull the latest trace-v6.11-rc3 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace-v6.11-rc3
Tag SHA1: 436b8a891cd73d07847c86cd55ff7f8f17f47dfe
Head SHA1: 90574d2a675947858b47008df8d07f75ea50d0d0
Dan Carpenter (1):
rtla/osnoise: Prevent NULL dereference in error handling
Steven Rostedt (1):
tracing: Return from tracing_buffers_read() if the file has been closed
----
kernel/trace/trace.c | 2 +-
tools/tracing/rtla/src/osnoise_top.c | 11 ++++-------
2 files changed, 5 insertions(+), 8 deletions(-)
---------------------------
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 10cd38bce2f1..ebe7ce2f5f4a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7956,7 +7956,7 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
trace_access_unlock(iter->cpu_file);
if (ret < 0) {
- if (trace_empty(iter)) {
+ if (trace_empty(iter) && !iter->closed) {
if ((filp->f_flags & O_NONBLOCK))
return -EAGAIN;
diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c
index f594a44df840..2f756628613d 100644
--- a/tools/tracing/rtla/src/osnoise_top.c
+++ b/tools/tracing/rtla/src/osnoise_top.c
@@ -651,8 +651,10 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params)
return NULL;
tool->data = osnoise_alloc_top(nr_cpus);
- if (!tool->data)
- goto out_err;
+ if (!tool->data) {
+ osnoise_destroy_tool(tool);
+ return NULL;
+ }
tool->params = params;
@@ -660,11 +662,6 @@ struct osnoise_tool *osnoise_init_top(struct osnoise_top_params *params)
osnoise_top_handler, NULL);
return tool;
-
-out_err:
- osnoise_free_top(tool->data);
- osnoise_destroy_tool(tool);
- return NULL;
}
static int stop_tracing;
Powered by blists - more mailing lists