mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LuMingYin <lumingyindetect@126.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [GIT PULL] probes: Fixes for v6.9-rc6
Date: Sat, 4 May 2024 22:19:17 +0900	[thread overview]
Message-ID: <20240504221917.4917a9eac7ab8cc90a0af5a1@kernel.org> (raw)

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>

             reply	other threads:[~2024-05-04 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 13:19 Masami Hiramatsu [this message]
2024-05-05 17:13 ` pr-tracker-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240504221917.4917a9eac7ab8cc90a0af5a1@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumingyindetect@126.com \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®