From: Peter Hurley <peter@hurleysoftware.com>
To: channing <chao.bi@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty_buffer: avoid race due to tty_buffer_free_all() being misused
Date: Thu, 16 May 2013 08:54:17 -0400 [thread overview]
Message-ID: <5194D6F9.5000505@hurleysoftware.com> (raw)
In-Reply-To: <1368694762.2911.16.camel@bichao>
On 05/16/2013 04:59 AM, channing wrote:
>
> In tty_buffer.c, function tty_buffer_free_all() is used to remove
> all buffers for a tty, although it's declared that it mustn't be called
> when the tty is in use, it cannot guarantee that. we can observe some
> device driver make use it by mistake, for example, while tty device is
> releasing, the tty data forwarding is not stopped, then it might hit
> the case that tty buffer is being used while tty_buffer_free_all()
> free this tty buffer, and finally lead to random error at any places,
> and it's not clear to debug.
What kernel version?
> Although device driver could do better, it's simpler and safer to
> strengthen protection in the view of tty buffer, by adding a tty->buf.lock
> in tty_buffer_free_all() to avoid it racing with ongoing tty buffer
> operations.
Sorry, but this isn't correct.
The driver cannot continue to perform i/o concurrently with
tty_port_destroy().
If the concurrent use you're observing is with flush_to_ldisc(),
that should be fixed in current mainline.
Regards,
Peter Hurley
next prev parent reply other threads:[~2013-05-16 12:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 8:59 [PATCH] tty_buffer: avoid race due to tty_buffer_free_all() being misused channing
2013-05-16 12:54 ` Peter Hurley [this message]
2013-05-17 6:29 ` channing
2013-05-17 18:47 ` Peter Hurley
2013-05-16 14:05 ` Greg Kroah-Hartman
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=5194D6F9.5000505@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=chao.bi@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--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