linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tracing/user_events: Fix call print_fmt leak
@ 2022-11-23 18:32 Beau Belgrave
  2022-11-25  1:10 ` Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Beau Belgrave @ 2022-11-23 18:32 UTC (permalink / raw)
  To: rostedt, mhiramat; +Cc: linux-trace-devel, linux-kernel

If user_event_trace_register() fails within user_event_parse() the
call's print_fmt member is not freed. Add kfree call to fix this.

Fixes: aa3b2b4c6692 ("user_events: Add print_fmt generation support for basic types")
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
---
 kernel/trace/trace_events_user.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index ae78c2d53c8a..b46844736015 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1357,6 +1357,7 @@ static int user_event_parse(struct user_event_group *group, char *name,
 put_user:
 	user_event_destroy_fields(user);
 	user_event_destroy_validators(user);
+	kfree(user->call.print_fmt);
 	kfree(user);
 	return ret;
 }
-- 
2.25.1


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

* Re: [PATCH] tracing/user_events: Fix call print_fmt leak
  2022-11-23 18:32 [PATCH] tracing/user_events: Fix call print_fmt leak Beau Belgrave
@ 2022-11-25  1:10 ` Masami Hiramatsu
  0 siblings, 0 replies; 2+ messages in thread
From: Masami Hiramatsu @ 2022-11-25  1:10 UTC (permalink / raw)
  To: Beau Belgrave; +Cc: rostedt, linux-trace-devel, linux-kernel

On Wed, 23 Nov 2022 10:32:48 -0800
Beau Belgrave <beaub@linux.microsoft.com> wrote:

> If user_event_trace_register() fails within user_event_parse() the
> call's print_fmt member is not freed. Add kfree call to fix this.
> 
> Fixes: aa3b2b4c6692 ("user_events: Add print_fmt generation support for basic types")
> Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>

This looks good to me.

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

Thank you!

> ---
>  kernel/trace/trace_events_user.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
> index ae78c2d53c8a..b46844736015 100644
> --- a/kernel/trace/trace_events_user.c
> +++ b/kernel/trace/trace_events_user.c
> @@ -1357,6 +1357,7 @@ static int user_event_parse(struct user_event_group *group, char *name,
>  put_user:
>  	user_event_destroy_fields(user);
>  	user_event_destroy_validators(user);
> +	kfree(user->call.print_fmt);
>  	kfree(user);
>  	return ret;
>  }
> -- 
> 2.25.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

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

end of thread, other threads:[~2022-11-25  1:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 18:32 [PATCH] tracing/user_events: Fix call print_fmt leak Beau Belgrave
2022-11-25  1:10 ` Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).