From: Paul Fulghum <paulkf@microgate.com>
To: Laurent Pinchart <laurentp@cse-semaphore.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Serial buffer memory leak
Date: Wed, 08 Aug 2007 08:13:33 -0600 [thread overview]
Message-ID: <46B9CF8D.1000209@microgate.com> (raw)
In-Reply-To: <200708081158.06843.laurentp@cse-semaphore.com>
Laurent Pinchart wrote:
> Patch c5c34d4862e18ef07c1276d233507f540fb5a532 (tty: flush flip buffer on
> ldisc input queue flush) introduces a race condition which can lead to memory
> leaks.
>
> The problem can be triggered when tcflush() is called when data are being
> pushed to the line discipline driver by flush_to_ldisc().
>
> flush_to_ldisc() releases tty->buf.lock when calling the line discipline
> receive_buf function. At that poing tty_buffer_flush() kicks in and sets both
> tty->buf.head and tty->buf.tail to NULL. When flush_to_ldisc() finishes, it
> restores tty->buf.head but doesn't touch tty->buf.tail. This corrups the
> buffer queue, and the next call to tty_buffer_request_room() will allocate a
> new buffer and overwrite tty->buf.head. The previous buffer is then lost
> forever without being released.
Your description is clear enough, I'll make the patch.
Thanks,
Paul
prev parent reply other threads:[~2007-08-08 13:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 9:58 Serial buffer memory leak Laurent Pinchart
2007-08-08 13:45 ` Alan Cox
2007-08-08 14:11 ` Paul Fulghum
2007-08-08 14:28 ` Laurent Pinchart
2007-08-08 14:52 ` Paul Fulghum
2007-08-08 15:16 ` Alan Cox
2007-08-08 15:32 ` Alan Cox
2007-08-08 17:35 ` Paul Fulghum
2007-08-08 14:26 ` Frederik Deweerdt
2007-08-08 14:13 ` Paul Fulghum [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=46B9CF8D.1000209@microgate.com \
--to=paulkf@microgate.com \
--cc=laurentp@cse-semaphore.com \
--cc=linux-kernel@vger.kernel.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