Hi Linus,
Probes fixes for v6.9-rc6:
- probe-events: Fix memory leak in parsing probe argument. There is a
memory leak (forget to free an allocated buffer) in a memory allocation
failure path. Fixes it to jump to the correct error handling code.
Please pull the latest probes-fixes-v6.9-rc6 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-fixes-v6.9-rc6
Tag SHA1: 7ecfa9b34f812e244746158de5abfdd5132a4a62
Head SHA1: dce3696271af7765f04428ec31b1b87dc7d016c6
LuMingYin (1):
tracing/probes: Fix memory leak in traceprobe_parse_probe_arg_body()
----
kernel/trace/trace_probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---------------------------
commit dce3696271af7765f04428ec31b1b87dc7d016c6
Author: LuMingYin <[email protected]>
Date: Sat Apr 27 08:23:47 2024 +0100
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: 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]>
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);
--
Masami Hiramatsu (Google) <[email protected]>
The pull request you sent on Sat, 4 May 2024 22:19:17 +0900:
> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git probes-fixes-v6.9-rc6
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/2c17a1cd90a5d385a7138c030e815e3effc45677
Thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html