Skip to content

Commit dce3696

Browse files
LuMingYinmhiramat
authored andcommitted
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/[email protected]/ Fixes: 032330a ("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]>
1 parent e67572c commit dce3696

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/trace_probe.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size,
14661466
parg->fmt = kmalloc(len, GFP_KERNEL);
14671467
if (!parg->fmt) {
14681468
ret = -ENOMEM;
1469-
goto out;
1469+
goto fail;
14701470
}
14711471
snprintf(parg->fmt, len, "%s[%d]", parg->type->fmttype,
14721472
parg->count);

0 commit comments

Comments
 (0)