aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-11 01:40:57 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-01-27 18:01:44 -0500
commitece53405a1f8ddf60b78e1365addcad521b2c93f (patch)
treec5078f6e4067c27b2f68595a2dcbe2575fc655b8 /drivers/tty
parentfdfb719e93b55a50f90da2059dc450e7c0c48e8f (diff)
tty: Reset c_line from driver's init_termios
After the ldisc is released, but before the tty is destroyed, the termios is saved (in tty_free_termios()); this termios is restored if a new tty is created on next open(). However, the line discipline is always reset, which is not obvious in the current method. Instead, reset as part of the restore. Restore the original line discipline, which may not have been N_TTY. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/tty_io.c5
-rw-r--r--drivers/tty/tty_ldisc.c3
2 files changed, 3 insertions, 5 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 524703a7df2b..71a9409c8d7e 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1387,9 +1387,10 @@ void tty_init_termios(struct tty_struct *tty)
1387 else { 1387 else {
1388 /* Check for lazy saved data */ 1388 /* Check for lazy saved data */
1389 tp = tty->driver->termios[idx]; 1389 tp = tty->driver->termios[idx];
1390 if (tp != NULL) 1390 if (tp != NULL) {
1391 tty->termios = *tp; 1391 tty->termios = *tp;
1392 else 1392 tty->termios.c_line = tty->driver->init_termios.c_line;
1393 } else
1393 tty->termios = tty->driver->init_termios; 1394 tty->termios = tty->driver->init_termios;
1394 } 1395 }
1395 /* Compatibility until drivers always set this */ 1396 /* Compatibility until drivers always set this */
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 713cc2d48846..b2e8210639dd 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -743,9 +743,6 @@ static void tty_ldisc_kill(struct tty_struct *tty)
743 tty_ldisc_put(tty->ldisc); 743 tty_ldisc_put(tty->ldisc);
744 /* Force an oops if we mess this up */ 744 /* Force an oops if we mess this up */
745 tty->ldisc = NULL; 745 tty->ldisc = NULL;
746
747 /* Ensure the next open requests the N_TTY ldisc */
748 tty_set_termios_ldisc(tty, N_TTY);
749} 746}
750 747
751/** 748/**