mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tracing/dynevent: Fix a memory leak in an error handling path
@ 2021-04-11 10:21 Christophe JAILLET
  2021-04-12  8:56 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-04-11 10:21 UTC (permalink / raw)
  To: rostedt, mingo, zanussi, mhiramat
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

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")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 kernel/trace/trace_dynevent.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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) {
-- 
2.27.0


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

* Re: [PATCH] tracing/dynevent: Fix a memory leak in an error handling path
  2021-04-11 10:21 [PATCH] tracing/dynevent: Fix a memory leak in an error handling path Christophe JAILLET
@ 2021-04-12  8:56 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2021-04-12  8:56 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: rostedt, mingo, zanussi, linux-kernel, kernel-janitors

On Sun, 11 Apr 2021 12:21:54 +0200
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> We must free 'argv' before returning, as already done in all the other
> paths of this function.

OOps, thanks for finding the bug!

> 
> Fixes: d262271d0483 ("tracing/dynevent: Delegate parsing to create function")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you,

> ---
>  kernel/trace/trace_dynevent.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> 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) {
> -- 
> 2.27.0
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

end of thread, other threads:[~2021-04-12  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-11 10:21 [PATCH] tracing/dynevent: Fix a memory leak in an error handling path Christophe JAILLET
2021-04-12  8:56 ` Masami Hiramatsu

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®