UPSTREAM: drm/edid: Extract SADs properly from multiple audio data blocks
[firefly-linux-kernel-4.4.55.git] / drivers / tty / tty_ldisc.c
index 5af8f1874c1aab02fc16dbb0950d7264caa282ca..9bee25cfa0be5e5a39cd00a2aa8e2fd57ac69096 100644 (file)
@@ -417,6 +417,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_rwsem
  */
 
@@ -425,6 +429,9 @@ static void tty_set_termios_ldisc(struct tty_struct *tty, int num)
        down_write(&tty->termios_rwsem);
        tty->termios.c_line = num;
        up_write(&tty->termios_rwsem);
+
+       tty->disc_data = NULL;
+       tty->receive_room = 0;
 }
 
 /**
@@ -592,7 +599,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
 
        /* Restart the work queue in case no characters kick it off. Safe if
           already running */
-       schedule_work(&tty->port->buf.work);
+       tty_buffer_restart_work(tty->port);
 
        tty_unlock(tty);
        return retval;