Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e00bbfb authored by Peter Hurley's avatar Peter Hurley Committed by Greg Kroah-Hartman
Browse files

tty: Fix merge of "tty: Refactor tty_open()"



Commit e9036d06 ("tty: Drop krefs for interrupted tty lock")
fixed a tty reference counting problem introduced in
commit 0bfd464d ("tty: Wait interruptibly for tty lock on reopen"),
so v4.5.0 is correct.

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

Signed-off-by: default avatarPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent da5a0fc6
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode,
	if (tty) {
	if (tty) {
		mutex_unlock(&tty_mutex);
		mutex_unlock(&tty_mutex);
		retval = tty_lock_interruptible(tty);
		retval = tty_lock_interruptible(tty);
		tty_kref_put(tty);  /* drop kref from tty_driver_lookup_tty() */
		if (retval) {
		if (retval) {
			if (retval == -EINTR)
			if (retval == -EINTR)
				retval = -ERESTARTSYS;
				retval = -ERESTARTSYS;
			tty = ERR_PTR(retval);
			tty = ERR_PTR(retval);
			goto out;
			goto out;
		}
		}
		/* safe to drop the kref from tty_driver_lookup_tty() */
		tty_kref_put(tty);
		retval = tty_reopen(tty);
		retval = tty_reopen(tty);
		if (retval < 0) {
		if (retval < 0) {
			tty_unlock(tty);
			tty_unlock(tty);