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>
This commit is contained in:
Peter Hurley 2016-01-10 22:40:57 -08:00 коммит произвёл Greg Kroah-Hartman
Родитель fdfb719e93
Коммит ece53405a1
2 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -1387,9 +1387,10 @@ void tty_init_termios(struct tty_struct *tty)
else {
/* Check for lazy saved data */
tp = tty->driver->termios[idx];
if (tp != NULL)
if (tp != NULL) {
tty->termios = *tp;
else
tty->termios.c_line = tty->driver->init_termios.c_line;
} else
tty->termios = tty->driver->init_termios;
}
/* Compatibility until drivers always set this */

Просмотреть файл

@ -743,9 +743,6 @@ static void tty_ldisc_kill(struct tty_struct *tty)
tty_ldisc_put(tty->ldisc);
/* Force an oops if we mess this up */
tty->ldisc = NULL;
/* Ensure the next open requests the N_TTY ldisc */
tty_set_termios_ldisc(tty, N_TTY);
}
/**