Commit dce36962 authored by LuMingYin's avatar LuMingYin Committed by Masami Hiramatsu (Google)

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: 032330ab ("tracing/probes: Cleanup probe argument parser")
Signed-off-by: default avatarLuMingYin <lumingyindetect@126.com>
Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
parent e67572cd
...@@ -1466,7 +1466,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, ...@@ -1466,7 +1466,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
parg->fmt = kmalloc(len, GFP_KERNEL); parg->fmt = kmalloc(len, GFP_KERNEL);
if (!parg->fmt) { if (!parg->fmt) {
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto fail;
} }
snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype, snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
parg->count); parg->count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment