Skip to content

Commit e7b38d3

Browse files
tracing: tprobe-events: Fix a memory leak when tprobe with $retval
JIRA: https://issues.redhat.com/browse/RHEL-86682 commit ac965d7 Author: Masami Hiramatsu (Google) <mhiramat@kernel.org> Date: Wed Feb 26 15:18:46 2025 +0900 tracing: tprobe-events: Fix a memory leak when tprobe with $retval Fix a memory leak when a tprobe is defined with $retval. This combination is not allowed, but the parse_symbol_and_return() does not free the *symbol which should not be used if it returns the error. Thus, it leaks the *symbol memory in that error path. Link: https://lore.kernel.org/all/174055072650.4079315.3063014346697447838.stgit@mhiramat.tok.corp.google.com/ Fixes: ce51e61 ("tracing: fprobe-event: Fix to check tracepoint event and return") Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org> Cc: stable@vger.kernel.org Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
1 parent d62eba6 commit e7b38d3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/trace_fprobe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,8 @@ static int parse_symbol_and_return(int argc, const char *argv[],
10251025
if (is_tracepoint) {
10261026
trace_probe_log_set_index(i);
10271027
trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE);
1028+
kfree(*symbol);
1029+
*symbol = NULL;
10281030
return -EINVAL;
10291031
}
10301032
*is_return = true;

0 commit comments

Comments
 (0)