aboutsummaryrefslogtreecommitdiff
path: root/kernel/trace
diff options
context:
space:
mode:
authorGravatar LuMingYin <lumingyindetect@126.com> 2024-04-27 08:23:47 +0100
committerGravatar Masami Hiramatsu (Google) <mhiramat@kernel.org> 2024-04-29 22:30:46 +0900
commitdce3696271af7765f04428ec31b1b87dc7d016c6 (patch)
treeba4d2bcf1bf329a130b8a0338048723d5d4312c5 /kernel/trace
parentLinux 6.9-rc6 (diff)
downloadlinux-dce3696271af7765f04428ec31b1b87dc7d016c6.tar.gz
linux-dce3696271af7765f04428ec31b1b87dc7d016c6.tar.bz2
linux-dce3696271af7765f04428ec31b1b87dc7d016c6.zip
tracing/probes: Fix memory leak in traceprobe_parse_probe_arg_body()
If traceprobe_parse_probe_arg_body() failed to allocate 'parg->fmt', it jumps to the label 'out' instead of 'fail' by mistake.In the result, the buffer 'tmp' is not freed in this case and leaks its memory. Thus jump to the label 'fail' in that error case. Link: https://lore.kernel.org/all/20240427072347.1421053-1-lumingyindetect@126.com/ Fixes: 032330abd08b ("tracing/probes: Cleanup probe argument parser") Signed-off-by: LuMingYin <lumingyindetect@126.com> Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_probe.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index dfe3ee6035ec..42bc0f362226 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1466,7 +1466,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
parg->fmt = kmalloc(len, GFP_KERNEL);
if (!parg->fmt) {
ret = -ENOMEM;
- goto out;
+ goto fail;
}
snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
parg->count);