From: Jeff Liu <jeff.liu@oracle.com>
To: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-serial@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [PATCH] drivers/tty/tty_io.c: fix a potential memleak at do_tty_write()
Date: Tue, 19 Jun 2012 11:44:35 +0800 [thread overview]
Message-ID: <4FDFF5A3.9050306@oracle.com> (raw)
In-Reply-To: <4FDF6CCE.7090709@microgate.com>
On 06/19/2012 02:00 AM, Paul Fulghum wrote:
> On 6/18/2012 11:04 AM, Alan Cox wrote:
>> On Mon, 18 Jun 2012 20:23:54 +0800
>> Jeff Liu <jeff.liu@oracle.com> wrote:
>>
>>> Hello,
>>>
>>> Looks there is a potential memory leak at drivers/tty/tty_io.c: do_tty_write().
>>> It did allocate a buf_chunk if tty->write_cnt < chunk, however, buf_chunk was not
>>> freed after the writing is done. Below tiny patch could fix it.
>>
>> Why should it be freed, we still have a reference to it.
>
> Yeah, it would be messy on the next write()
> when the now freed tty->write_buf is accessed ;-)
> *boom*
Oops! I took for granted previously. Duh. :(
Sorry for the noise!
-Jeff
prev parent reply other threads:[~2012-06-19 3:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 12:23 [PATCH] drivers/tty/tty_io.c: fix a potential memleak at do_tty_write() Jeff Liu
2012-06-18 15:26 ` Greg KH
2012-06-18 16:04 ` Alan Cox
2012-06-18 18:00 ` Paul Fulghum
2012-06-19 3:44 ` Jeff Liu [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=4FDFF5A3.9050306@oracle.com \
--to=jeff.liu@oracle.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=linux-serial@vger.kernel.org \
--cc=paulkf@microgate.com \
/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