summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2015-10-31 15:54:32 +0300
committerSasha Levin <sasha.levin@oracle.com>2015-10-31 15:54:32 +0300
commit80e5c4ddd2fcbf99edd31a7c1379b3907cfd4f38 (patch)
tree458417709b52b633226534d82b35cc01a22ce9cb
parent8341455f7f2b36212f8cdded7725e93b17f5a8fc (diff)
downloadlinux-80e5c4ddd2fcbf99edd31a7c1379b3907cfd4f38.tar.xz
Revert "tty: fix stall caused by missing memory barrier in drivers/tty/n_tty.c"
This reverts commit af32cc7bde6304dac92e6a74fe4b2cc8120cb29a. The commit was incorrectly backported and was causing hangs. Reported-by: Corey Wright <undefined@pobox.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--drivers/tty/n_tty.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index fea7d905e77c..e3ebb674a693 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -364,8 +364,8 @@ static void n_tty_packet_mode_flush(struct tty_struct *tty)
spin_lock_irqsave(&tty->ctrl_lock, flags);
if (tty->link->packet) {
tty->ctrl_status |= TIOCPKT_FLUSHREAD;
- spin_unlock_irqrestore(&tty->ctrl_lock, flags);
- wake_up_interruptible(&tty->link->read_wait);
+ if (waitqueue_active(&tty->link->read_wait))
+ wake_up_interruptible(&tty->link->read_wait);
}
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
}
@@ -1387,7 +1387,8 @@ handle_newline:
put_tty_queue(c, ldata);
ldata->canon_head = ldata->read_head;
kill_fasync(&tty->fasync, SIGIO, POLL_IN);
- wake_up_interruptible_poll(&tty->read_wait, POLLIN);
+ if (waitqueue_active(&tty->read_wait))
+ wake_up_interruptible_poll(&tty->read_wait, POLLIN);
return 0;
}
}
@@ -1670,7 +1671,8 @@ static void __receive_buf(struct tty_struct *tty, const unsigned char *cp,
if ((!ldata->icanon && (read_cnt(ldata) >= ldata->minimum_to_wake)) ||
L_EXTPROC(tty)) {
kill_fasync(&tty->fasync, SIGIO, POLL_IN);
- wake_up_interruptible_poll(&tty->read_wait, POLLIN);
+ if (waitqueue_active(&tty->read_wait))
+ wake_up_interruptible_poll(&tty->read_wait, POLLIN);
}
}
@@ -1889,8 +1891,10 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
}
/* The termios change make the tty ready for I/O */
- wake_up_interruptible(&tty->write_wait);
- wake_up_interruptible(&tty->read_wait);
+ if (waitqueue_active(&tty->write_wait))
+ wake_up_interruptible(&tty->write_wait);
+ if (waitqueue_active(&tty->read_wait))
+ wake_up_interruptible(&tty->read_wait);
}
/**