Skip to content

Commit

Permalink
tracing: Free module_delta on freeing of persistent ring buffer
Browse files Browse the repository at this point in the history
If a persistent ring buffer is created, a "module_delta" array is also
allocated to hold the module deltas of loaded modules that match modules
in the scratch area. If this buffer gets freed, the module_delta array is
not freed and causes a memory leak.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250401124525.1f9ac02a@gandalf.local.home
Fixes: 35a380d ("tracing: Show last module text symbols in the stacktrace")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
  • Loading branch information
Steven Rostedt committed Apr 2, 2025
1 parent b81ff11 commit 2c9ee74
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -9609,6 +9609,7 @@ static void free_trace_buffers(struct trace_array *tr)
return;

free_trace_buffer(&tr->array_buffer);
kfree(tr->module_delta);

#ifdef CONFIG_TRACER_MAX_TRACE
free_trace_buffer(&tr->max_buffer);
Expand Down

0 comments on commit 2c9ee74

Please sign in to comment.