From: Peter Hurley <peter@hurleysoftware.com>
To: Ilya Zykov <ilya@ilyx.ru>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alan Cox <alan@linux.intel.com>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
Jiri Slaby <jslaby@suse.cz>,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH 4/4] pty: Ignore slave open count for master pty open
Date: Wed, 30 Jan 2013 12:43:52 -0500 [thread overview]
Message-ID: <1359567832-25318-5-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1359567832-25318-1-git-send-email-peter@hurleysoftware.com>
Multiple slave pty opens may be performed in parallel with the
master open. Of course, all the slave opens will fail because the
master pty is still locked but during this time the slave pty
count will be artificially greater than 1. This is should not
cause the master pty open to fail.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/pty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 6eb3e80..7a18600 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -256,7 +256,7 @@ static int pty_open(struct tty_struct *tty, struct file *filp)
goto out;
if (test_bit(TTY_PTY_LOCK, &tty->link->flags))
goto out;
- if (tty->link->count != 1)
+ if (tty->driver->subtype == PTY_TYPE_SLAVE && tty->link->count != 1)
goto out;
clear_bit(TTY_IO_ERROR, &tty->flags);
--
1.8.1.1
prev parent reply other threads:[~2013-01-30 17:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 17:43 [PATCH 0/4] Fix parallel master and slave pty opens Peter Hurley
2013-01-30 17:43 ` [PATCH 1/4] pty: Fix BUG()s when ptmx_open() errors out Peter Hurley
2013-01-30 17:43 ` [PATCH 2/4] pty: Ignore slave pty close() if never successfully opened Peter Hurley
2013-01-30 17:43 ` [PATCH 3/4] tty: Document required behavior of tty driver close() Peter Hurley
2013-01-30 17:43 ` Peter Hurley [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=1359567832-25318-5-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=ilya@ilyx.ru \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@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;
as well as URLs for NNTP newsgroup(s).