linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] tty: Always allow tcflow(TCOON) to unwedge terminal
@ 2014-09-10 21:28 Peter Hurley
  2014-09-11  0:03 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Hurley @ 2014-09-10 21:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, One Thousand Gnomes, linux-serial, linux-kernel,
	Peter Hurley

This patch changes user-space behavior (for the better) but I'm not sure
that it's consequence-free. Also, it might not be enough to unwedge the
terminal if the driver got its own flow control state mangled.

Thoughts?

--- >% ---
Subject: [RFC] tty: Always allow tcflow(TCOON) to unwedge terminal

If terminal flow has been stopped, the terminal can be unwedged
by:
	tcflow(fd, TCOOFF);
	tcflow(fd, TCOON);
This works because tcflow(TCOOFF) ensures that ->flow_stopped is set,
which allows tcflow(TCOON) to override the terminal flow state in
__start_tty().

Instead, allow unwedging with only:
        tcflow(fd, TCOON);
by disregarding the existing ->flow_stopped state.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/tty_ioctl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 32cee97..c792088 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -1157,10 +1157,8 @@ int n_tty_ioctl_helper(struct tty_struct *tty, struct file *file,
 			break;
 		case TCOON:
 			spin_lock_irq(&tty->flow_lock);
-			if (tty->flow_stopped) {
-				tty->flow_stopped = 0;
-				__start_tty(tty);
-			}
+			tty->flow_stopped = 0;
+			__start_tty(tty);
 			spin_unlock_irq(&tty->flow_lock);
 			break;
 		case TCIOFF:
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-09-11 15:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-10 21:28 [RFC] tty: Always allow tcflow(TCOON) to unwedge terminal Peter Hurley
2014-09-11  0:03 ` Greg Kroah-Hartman
2014-09-11  0:11   ` Peter Hurley
2014-09-11  0:24     ` Greg Kroah-Hartman
2014-09-11  0:45       ` Peter Hurley
2014-09-11 13:56         ` Theodore Ts'o
2014-09-11 15:40           ` Peter Hurley
2014-09-11 15:50             ` Theodore Ts'o
2014-09-11 10:19     ` One Thousand Gnomes
2014-09-11 12:34       ` Peter Hurley

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).