aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index 96dc6dd31425..d38455fab4b7 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -38,9 +38,12 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
38 if (tty->driver->subtype == PTY_TYPE_MASTER) 38 if (tty->driver->subtype == PTY_TYPE_MASTER)
39 WARN_ON(tty->count > 1); 39 WARN_ON(tty->count > 1);
40 else { 40 else {
41 if (test_bit(TTY_IO_ERROR, &tty->flags))
42 return;
41 if (tty->count > 2) 43 if (tty->count > 2)
42 return; 44 return;
43 } 45 }
46 set_bit(TTY_IO_ERROR, &tty->flags);
44 wake_up_interruptible(&tty->read_wait); 47 wake_up_interruptible(&tty->read_wait);
45 wake_up_interruptible(&tty->write_wait); 48 wake_up_interruptible(&tty->write_wait);
46 tty->packet = 0; 49 tty->packet = 0;
@@ -246,6 +249,8 @@ static int pty_open(struct tty_struct *tty, struct file *filp)
246 if (!tty || !tty->link) 249 if (!tty || !tty->link)
247 goto out; 250 goto out;
248 251
252 set_bit(TTY_IO_ERROR, &tty->flags);
253
249 retval = -EIO; 254 retval = -EIO;
250 if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) 255 if (test_bit(TTY_OTHER_CLOSED, &tty->flags))
251 goto out; 256 goto out;
@@ -254,6 +259,7 @@ static int pty_open(struct tty_struct *tty, struct file *filp)
254 if (tty->link->count != 1) 259 if (tty->link->count != 1)
255 goto out; 260 goto out;
256 261
262 clear_bit(TTY_IO_ERROR, &tty->flags);
257 clear_bit(TTY_OTHER_CLOSED, &tty->link->flags); 263 clear_bit(TTY_OTHER_CLOSED, &tty->link->flags);
258 set_bit(TTY_THROTTLED, &tty->flags); 264 set_bit(TTY_THROTTLED, &tty->flags);
259 retval = 0; 265 retval = 0;