From: Wenwen Wang <wang6495@umn.edu>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>, open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: Fix a memory leak bug
Date: Fri, 19 Apr 2019 22:08:08 -0500 [thread overview]
Message-ID: <CAAa=b7dnrz5Pz5hMUc29VHJb9ucFkWArd2sbsCUO+POfuFXFhA@mail.gmail.com> (raw)
In-Reply-To: <20190419223718.17fa8246@oasis.local.home>
On Fri, Apr 19, 2019 at 9:37 PM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Fri, 19 Apr 2019 21:22:59 -0500
> Wenwen Wang <wang6495@umn.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
prev parent reply other threads:[~2019-04-20 3:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-20 2:22 [PATCH] tracing: Fix a memory leak bug Wenwen Wang
2019-04-20 2:37 ` Steven Rostedt
2019-04-20 3:08 ` Wenwen Wang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAa=b7dnrz5Pz5hMUc29VHJb9ucFkWArd2sbsCUO+POfuFXFhA@mail.gmail.com' \
--to=wang6495@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).