mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Subject: [GIT PULL] tracing/dynevent: Fix a memory leak in an error handling path
Date: Tue, 13 Apr 2021 20:37:16 -0400	[thread overview]
Message-ID: <20210413203716.339a87ee@gandalf.local.home> (raw)

Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Linus,

tracing/dynevent: Fix a memory link in dyn_event_release()

An error path exited the function before freeing the allocated
"argv" variable.


Please pull the latest trace-v5.12-rc7 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-v5.12-rc7

Tag SHA1: 682c26c6e8cf02be8c898a712bbd5ffd75c83616
Head SHA1: 8db403b9631331ef1d5e302cdf353c48849ca9d5


Christophe JAILLET (1):
      tracing/dynevent: Fix a memory leak in an error handling path

----
 kernel/trace/trace_dynevent.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---------------------------
commit 8db403b9631331ef1d5e302cdf353c48849ca9d5
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Date:   Sun Apr 11 12:21:54 2021 +0200

    tracing/dynevent: Fix a memory leak in an error handling path
    
    We must free 'argv' before returning, as already done in all the other
    paths of this function.
    
    Link: https://lkml.kernel.org/r/21e3594ccd7fc88c5c162c98450409190f304327.1618136448.git.christophe.jaillet@wanadoo.fr
    
    Fixes: d262271d0483 ("tracing/dynevent: Delegate parsing to create function")
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>

diff --git a/kernel/trace/trace_dynevent.c b/kernel/trace/trace_dynevent.c
index dc971a68dda4..e57cc0870892 100644
--- a/kernel/trace/trace_dynevent.c
+++ b/kernel/trace/trace_dynevent.c
@@ -63,8 +63,10 @@ int dyn_event_release(const char *raw_command, struct dyn_event_operations *type
 		event = p + 1;
 		*p = '\0';
 	}
-	if (event[0] == '\0')
-		return -EINVAL;
+	if (event[0] == '\0') {
+		ret = -EINVAL;
+		goto out;
+	}
 
 	mutex_lock(&event_mutex);
 	for_each_dyn_event_safe(pos, n) {

             reply	other threads:[~2021-04-14  0:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  0:37 Steven Rostedt [this message]
2021-04-14  1:44 ` 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=20210413203716.339a87ee@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.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®