mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [GIT PULL] probes: Fixes for v6.9-rc6
@ 2024-05-04 13:19 Masami Hiramatsu
  2024-05-05 17:13 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Masami Hiramatsu @ 2024-05-04 13:19 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: LuMingYin, Steven Rostedt, Masami Hiramatsu, linux-kernel

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 <lumingyindetect@126.com>
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/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>

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) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-05 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-04 13:19 [GIT PULL] probes: Fixes for v6.9-rc6 Masami Hiramatsu
2024-05-05 17:13 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®