Skip to contentSkip to conversation

tracing/dynevent: Fix a memory leak in an error handling path

GIT PULL Merged Steven Rostedt 2 participants 2 messages Apr 14, 2021 Tracing

lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

Christophe JAILLET <[email protected]>

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 <[email protected]>
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.

Fixes d262271d0483 ("tracing/dynevent: Delegate parsing to create function")
kernel/trace/trace_dynevent.c +4 -2
index dc971a68dda4..e57cc0870892 100644
@@ -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) {
merge bot Merged
#1 lore raw
The pull request you sent on Tue, 13 Apr 2021 20:37:16 -0400:

The pull request you sent on Tue, 13 Apr 2021 20:37:16 -0400:

Quoted 1 line

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

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/50987beca096a7ed4f453a6da245fd6a2fadedeb

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html