public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] ftrace: Fix direct_functions leak in update_ftrace_direct_del
@ 2026-02-02  7:58 Jiri Olsa
  2026-02-02 14:55 ` Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Olsa @ 2026-02-02  7:58 UTC (permalink / raw)
  To: Steven Rostedt, Alexei Starovoitov
  Cc: Alexei Starovoitov, bpf, linux-kernel, linux-trace-kernel,
	Daniel Borkmann, Andrii Nakryiko, Menglong Dong, Song Liu

Alexei reported memory leak in update_ftrace_direct_del.
We miss cleanup of the replaced direct_functions in the
success path in update_ftrace_direct_del, adding that.

Fixes: 8d2c1233f371 ("ftrace: Add update_ftrace_direct_del function")
Reported-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Closes: https://lore.kernel.org/bpf/aX_BxG5EJTJdCMT9@krava/T/#m7c13f5a95f862ed7ab78e905fbb678d635306a0c
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 kernel/trace/ftrace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 8574932e66b6..b12dbd93ae1c 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6537,6 +6537,7 @@ int update_ftrace_direct_del(struct ftrace_ops *ops, struct ftrace_hash *hash)
 		/* free the new_direct_functions */
 		old_direct_functions = new_direct_functions;
 	} else {
+		old_direct_functions = direct_functions;
 		rcu_assign_pointer(direct_functions, new_direct_functions);
 	}
 
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-02 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-02  7:58 [PATCH bpf-next] ftrace: Fix direct_functions leak in update_ftrace_direct_del Jiri Olsa
2026-02-02 14:55 ` Steven Rostedt
2026-02-02 16:00 ` patchwork-bot+netdevbpf
2026-02-02 18:51 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox