[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAa=b7dnrz5Pz5hMUc29VHJb9ucFkWArd2sbsCUO+POfuFXFhA@mail.gmail.com>
Date: Fri, 19 Apr 2019 22:08:08 -0500
From: Wenwen Wang <wang6495@....edu>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Ingo Molnar <mingo@...hat.com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tracing: Fix a memory leak bug
On Fri, Apr 19, 2019 at 9:37 PM Steven Rostedt <rostedt@...dmis.org> wrote:
>
> On Fri, 19 Apr 2019 21:22:59 -0500
> Wenwen Wang <wang6495@....edu> 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.
Wenwen
Powered by blists - more mailing lists