From: Steven Rostedt (VMware) Date: Thu, 2 Feb 2017 22:58:18 +0000 (-0500) Subject: tracing: Reset parser->buffer to allow multiple "puts" X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0e684b6578ee463ecb5c9a1cd0c20069f063d9f0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git tracing: Reset parser->buffer to allow multiple "puts" trace_parser_put() simply frees the allocated parser buffer. But it does not reset the pointer that was freed. This means that if trace_parser_put() is called on the same parser more than once, it will corrupt the allocation system. Setting parser->buffer to NULL after free allows it to be called more than once without any ill effect. Acked-by: Namhyung Kim Signed-off-by: Steven Rostedt (VMware) --- diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d7449783987a..4589b67168fc 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1193,6 +1193,7 @@ int trace_parser_get_init(struct trace_parser *parser, int size) void trace_parser_put(struct trace_parser *parser) { kfree(parser->buffer); + parser->buffer = NULL; } /*