import PULS_20180308
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / tty / tty_ldisc.c
index b7b8048f12539e2e672d902ce123056693a5a748..420dd6e52a2794439c52638503a5bf5c09ae5578 100644 (file)
@@ -415,6 +415,10 @@ EXPORT_SYMBOL_GPL(tty_ldisc_flush);
  *     they are not on hot paths so a little discipline won't do
  *     any harm.
  *
+ *     The line discipline-related tty_struct fields are reset to
+ *     prevent the ldisc driver from re-using stale information for
+ *     the new ldisc instance.
+ *
  *     Locking: takes termios_mutex
  */
 
@@ -423,6 +427,9 @@ static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
        mutex_lock(&tty->termios_mutex);
        tty->termios.c_line = num;
        mutex_unlock(&tty->termios_mutex);
+
+       tty->disc_data = NULL;
+       tty->receive_room = 0;
 }
 
 /**