diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2016-03-31 20:47:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-31 23:49:39 -0400 |
commit | 5e00bbfbc5ec21e87d24e206bba9fc2cbe6631a1 (patch) | |
tree | a63b856fa285275c27b315ff3c9376f462f41f99 /drivers/tty/tty_io.c | |
parent | da5a0fc6743df9b5a3e9f915a1ed16f45465d529 (diff) |
tty: Fix merge of "tty: Refactor tty_open()"
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>
Diffstat (limited to 'drivers/tty/tty_io.c')
-rw-r--r-- | drivers/tty/tty_io.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 876878a7704f..9b04d72e752e 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, | |||
2049 | if (tty) { | 2049 | if (tty) { |
2050 | mutex_unlock(&tty_mutex); | 2050 | mutex_unlock(&tty_mutex); |
2051 | retval = tty_lock_interruptible(tty); | 2051 | retval = tty_lock_interruptible(tty); |
2052 | tty_kref_put(tty); /* drop kref from tty_driver_lookup_tty() */ | ||
2052 | if (retval) { | 2053 | if (retval) { |
2053 | if (retval == -EINTR) | 2054 | if (retval == -EINTR) |
2054 | retval = -ERESTARTSYS; | 2055 | retval = -ERESTARTSYS; |
2055 | tty = ERR_PTR(retval); | 2056 | tty = ERR_PTR(retval); |
2056 | goto out; | 2057 | goto out; |
2057 | } | 2058 | } |
2058 | /* safe to drop the kref from tty_driver_lookup_tty() */ | ||
2059 | tty_kref_put(tty); | ||
2060 | retval = tty_reopen(tty); | 2059 | retval = tty_reopen(tty); |
2061 | if (retval < 0) { | 2060 | if (retval < 0) { |
2062 | tty_unlock(tty); | 2061 | tty_unlock(tty); |