Skip to content

Commit 5e00bbf

Browse files
peterhurleygregkh
authored andcommitted
tty: Fix merge of "tty: Refactor tty_open()"
Commit e9036d0 ("tty: Drop krefs for interrupted tty lock") fixed a tty reference counting problem introduced in commit 0bfd464 ("tty: Wait interruptibly for tty lock on reopen"), so v4.5.0 is correct. However, commit d6203d0 ("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>
1 parent da5a0fc commit 5e00bbf

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/tty/tty_io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
20492049
if (tty) {
20502050
mutex_unlock(&tty_mutex);
20512051
retval = tty_lock_interruptible(tty);
2052+
tty_kref_put(tty); /* drop kref from tty_driver_lookup_tty() */
20522053
if (retval) {
20532054
if (retval == -EINTR)
20542055
retval = -ERESTARTSYS;
20552056
tty = ERR_PTR(retval);
20562057
goto out;
20572058
}
2058-
/* safe to drop the kref from tty_driver_lookup_tty() */
2059-
tty_kref_put(tty);
20602059
retval = tty_reopen(tty);
20612060
if (retval < 0) {
20622061
tty_unlock(tty);

0 commit comments

Comments
 (0)