]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
tracing: Reset parser->buffer to allow multiple "puts"
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 2 Feb 2017 22:58:18 +0000 (17:58 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 3 Feb 2017 15:59:31 +0000 (10:59 -0500)
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 <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace.c

index d7449783987a2bee7dea147e02530f36ff23dfba..4589b67168fc04d39305290fa7562e46b24e31e0 100644 (file)
@@ -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;
 }
 
 /*