tracing/user_events: Fix call print_fmt leak
authorBeau Belgrave <beaub@linux.microsoft.com>
Wed, 23 Nov 2022 18:32:48 +0000 (10:32 -0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Mon, 28 Nov 2022 20:58:56 +0000 (15:58 -0500)
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: aa3b2b4c6692 ("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>
kernel/trace/trace_events_user.c

index 539b08a..9cb5318 100644 (file)
@@ -1359,6 +1359,7 @@ put_user_lock:
 put_user:
        user_event_destroy_fields(user);
        user_event_destroy_validators(user);
+       kfree(user->call.print_fmt);
        kfree(user);
        return ret;
 }