From: Joerg Roedel <joro@8bytes.org>
To: Jiri Slaby <jslaby@suse.cz>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: Add missing lock in n_tty_write()
Date: Wed, 15 May 2013 17:47:53 +0200 [thread overview]
Message-ID: <20130515154753.GJ24440@8bytes.org> (raw)
In-Reply-To: <5193A3B5.7010400@suse.cz>
On Wed, May 15, 2013 at 05:03:17PM +0200, Jiri Slaby wrote:
> On 05/15/2013 12:56 PM, Joerg Roedel wrote:
> Are you fixing any bug here? output_lock does not protect
> tty->ops->write on the other places, not tty->ops->write.
Yes, I am trying to fix a BUG_ON that triggered in
drivers/tty/hvc/hvc_xen.c in function __write_console(). This function
was called from the place I am patching in this fix. My current
explanation for that BUG_ON is a race condition that comes
from concurrent calls to that function.
That is also the only explanation that makes sense because the
__write_console() function itself makes sure that the condition can not
hit.
In the comment for the n_tty_write function there is this remark:
* Locking: output_lock to protect column state and space left
* (note that the process_output*() functions take this
* lock themselves)
So the space left is managed in the ->write callback and needs
protection.
The process_output*() functions all (unless I am missing something)
take the output_lock before calling the tty->ops->write (directly or
indirectly).
The place I patched here is the only place in n_tty_write where the
->write call-back is invoked directly, and it happens without taking the
lock. I think this is a problem.
Joerg
next prev parent reply other threads:[~2013-05-15 15:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 10:56 [PATCH] tty: Add missing lock in n_tty_write() Joerg Roedel
2013-05-15 15:03 ` Jiri Slaby
2013-05-15 15:47 ` Joerg Roedel [this message]
2013-05-15 18:45 ` Peter Hurley
2013-05-15 19:48 ` Joerg Roedel
2013-05-15 23:10 ` Peter Hurley
2013-05-17 11:48 ` Joerg Roedel
2013-05-17 19:08 ` Peter Hurley
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=20130515154753.GJ24440@8bytes.org \
--to=joro@8bytes.org \
--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