]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
tty: Fix merge of "tty: Refactor tty_open()"
authorPeter Hurley <peter@hurleysoftware.com>
Fri, 1 Apr 2016 00:47:07 +0000 (17:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Apr 2016 03:49:39 +0000 (20:49 -0700)
Commit e9036d066236 ("tty: Drop krefs for interrupted tty lock")
fixed a tty reference counting problem introduced in
commit 0bfd464d3fdd ("tty: Wait interruptibly for tty lock on reopen"),
so v4.5.0 is correct.

However, commit d6203d0c7b73 ("tty: Refactor tty_open()") moved the
relevant code for 4.6-rc1; correct the merge.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_io.c

index 876878a7704ff99e81314d559269f2cbf25f4a1a..9b04d72e752e5e398aef0122eabf0d9ba2d2e1c1 100644 (file)
@@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
        if (tty) {
                mutex_unlock(&tty_mutex);
                retval = tty_lock_interruptible(tty);
+               tty_kref_put(tty);  /* drop kref from tty_driver_lookup_tty() */
                if (retval) {
                        if (retval == -EINTR)
                                retval = -ERESTARTSYS;
                        tty = ERR_PTR(retval);
                        goto out;
                }
-               /* safe to drop the kref from tty_driver_lookup_tty() */
-               tty_kref_put(tty);
                retval = tty_reopen(tty);
                if (retval < 0) {
                        tty_unlock(tty);