]> Git Repo - linux.git/commitdiff
tracing/probes: Fix memory leak in traceprobe_parse_probe_arg_body()
authorLuMingYin <[email protected]>
Sat, 27 Apr 2024 07:23:47 +0000 (08:23 +0100)
committerMasami Hiramatsu (Google) <[email protected]>
Mon, 29 Apr 2024 13:30:46 +0000 (22:30 +0900)
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/[email protected]/
Fixes: 032330abd08b ("tracing/probes: Cleanup probe argument parser")
Signed-off-by: LuMingYin <[email protected]>
Acked-by: Masami Hiramatsu (Google) <[email protected]>
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
kernel/trace/trace_probe.c

index dfe3ee6035ecc74da70ebd8104d23f1ef2a25cde..42bc0f3622263b60618fbc8fd39f2f3beedf44a3 100644 (file)
@@ -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);
This page took 0.059498 seconds and 4 git commands to generate.