Merge tag 'media/v3.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[firefly-linux-kernel-4.4.55.git] / drivers / tty / pty.c
index bdb8fd1a202682e6e0eaf057c3cc88685c6ebc03..a9d256d6e909c1aecfc854732694d608256aeb15 100644 (file)
@@ -53,6 +53,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
        /* Review - krefs on tty_link ?? */
        if (!tty->link)
                return;
+       tty_flush_to_ldisc(tty->link);
        set_bit(TTY_OTHER_CLOSED, &tty->link->flags);
        wake_up_interruptible(&tty->link->read_wait);
        wake_up_interruptible(&tty->link->write_wait);
@@ -66,9 +67,7 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
                        mutex_unlock(&devpts_mutex);
                }
 #endif
-               tty_unlock(tty);
                tty_vhangup(tty->link);
-               tty_lock(tty);
        }
 }
 
@@ -399,6 +398,8 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
        if (!o_tty)
                goto err_put_module;
 
+       tty_set_lock_subclass(o_tty);
+
        if (legacy) {
                /* We always use new tty termios data so we can do this
                   the easy way .. */