summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>2025-02-26 15:18:46 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:01:49 +0100
commitb4a92f312ad9e973456d44bbad3f18c9f1e62ddf (patch)
tree3a61d3c7107a17899b1e5efae1f78c635c54530f /kernel
parent5b414ed3bbf63be8f373e61fdbd07932c28b2130 (diff)
downloadlinux-b4a92f312ad9e973456d44bbad3f18c9f1e62ddf.tar.gz
linux-b4a92f312ad9e973456d44bbad3f18c9f1e62ddf.tar.bz2
linux-b4a92f312ad9e973456d44bbad3f18c9f1e62ddf.zip
tracing: tprobe-events: Fix a memory leak when tprobe with $retval
commit ac965d7d88fc36fb42e3d50225c0a44dd8326da4 upstream. 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: ce51e6153f77 ("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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_fprobe.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index c62d1629cffe..db897992c29e 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -1025,6 +1025,8 @@ static int parse_symbol_and_return(int argc, const char *argv[],
if (is_tracepoint) {
trace_probe_log_set_index(i);
trace_probe_log_err(tmp - argv[i], RETVAL_ON_PROBE);
+ kfree(*symbol);
+ *symbol = NULL;
return -EINVAL;
}
*is_return = true;