[lkml]   [2019]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] tracing: Fix a memory leak bug
On Fri, Apr 19, 2019 at 9:37 PM Steven Rostedt <> wrote:
> On Fri, 19 Apr 2019 21:22:59 -0500
> Wenwen Wang <> wrote:
> > In trace_pid_write(), the buffer for trace parser is allocated through
> > kmalloc() in trace_parser_get_init(). Later on, after the buffer is used,
> > it is then freed through kfree() in trace_parser_put(). However, it is
> > possible that trace_pid_write() is terminated due to unexpected errors,
> > e.g., ENOMEM. In that case, the allocated buffer will not be freed, which
> > is a memory leak bug.
> >
> > To fix this issue, free the allocated buffer when an error is encountered.
> Thanks for the patch. Did you find this through manual inspection,
> running KASAN or via one of the static analyzers?

Thanks for your question, Steve. It was based on a prototype of a
research project, which aims to statically detect memory leak bugs in
operating system kernels.


 \ /
  Last update: 2019-04-20 05:09    [W:0.039 / U:1.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site