pty: Ignore slave open count for master pty open
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 30 Jan 2013 17:43:52 +0000 (12:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Feb 2013 23:40:29 +0000 (15:40 -0800)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/pty.c

index d38455fab4b7b749002375a84827490e83037ac4..c24b4db243b97fb97721730c6b5a7f57c2966ace 100644 (file)
@@ -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);