From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Carlier <devnexen@gmail.com>
Subject: [for-linus][PATCH 7/8] tracing: Fix trace_event_file leak on read-only instances
Date: Thu, 03 Dec 2026 09:17:32 -0500 [thread overview]
Message-ID: <20261203141757.408541509@kernel.org> (raw)
In-Reply-To: 20261203141725.845506016@kernel.org
From: David Carlier <devnexen@gmail.com>
event_create_dir() takes a reference on the trace_event_file that is
dropped by the release callback of the "enable" eventfs entry. A
read-only (backup) instance only registers the first
NR_RO_EVENT_ENTRIES entries, so release_ei() never reaches that
callback and every trace_event_file of the instance is leaked when it
is removed.
Move the release callback to the "format" entry, which all instances
have.
Cc: stable@vger.kernel.org # 7.1+
Fixes: 2c79da099aac ("tracing: Make the backup instance non-reusable")
Link: https://patch.msgid.link/20261201215912.723997-1-devnexen@gmail.com
Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 394d7cde1a70..60720d9236a1 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -3276,7 +3276,7 @@ static int event_callback(const char *name, umode_t *mode, void **data,
return 0;
}
-/* The file is incremented on creation and freeing the enable file decrements it */
+/* The file is incremented on creation and freeing the format file decrements it */
static void event_release(const char *name, void *data)
{
struct trace_event_file *file = data;
@@ -3298,6 +3298,7 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
{
.name = "format",
.callback = event_callback,
+ .release = event_release,
},
#ifdef CONFIG_PERF_EVENTS
{
@@ -3317,7 +3318,6 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
{
.name = "enable",
.callback = event_callback,
- .release = event_release,
},
{
.name = "filter",
@@ -3380,7 +3380,7 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
file->ei = ei;
- /* Gets decremented on freeing of the "enable" file */
+ /* Gets decremented on freeing of the "format" file */
event_file_get(file);
return 0;
--
2.53.0
next prev parent reply other threads:[~2026-12-03 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 14:17 [for-linus][PATCH 0/8] tracing: Fixes for v7.4 Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 1/8] tracing: Fix crash on lseek of recursed_functions file in WRONLY mode Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 2/8] tracing/filters: Fix glob matching on zero size string fields Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 3/8] ring-buffer: Use irqsave for the reader lock in ring_buffer_poll_remote Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 4/8] ring-buffer: Avoid reader_lock deadlock during panic Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 5/8] tracing/histograms: Reject non-string fields for synthetic string fields Steven Rostedt
2026-12-03 14:17 ` [for-linus][PATCH 6/8] tracing: Free all event filters after RCU synchronization Steven Rostedt
2026-12-03 14:17 ` Steven Rostedt [this message]
2026-12-03 14:17 ` [for-linus][PATCH 8/8] tracing: Reject backup instance opens only after autoremove is queued Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261203141757.408541509@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=devnexen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox