Skip to content

Commit

Permalink
tracing/user_events: Fix call print_fmt leak
Browse files Browse the repository at this point in the history
[ Upstream commit 4bded7a ]

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.

Link: https://lkml.kernel.org/r/20221123183248.554-1-beaub@linux.microsoft.com

Fixes: aa3b2b4 ("user_events: Add print_fmt generation support for basic types")
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Beau Belgrave authored and gregkh committed Dec 31, 2022
1 parent e4b7d72 commit 0a022b7
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/trace/trace_events_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,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;
}
Expand Down

0 comments on commit 0a022b7

Please sign in to comment.