Commit 0ef1698e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Revert "TTY: get rid of BTM around devpts_*"

This reverts commit d3bda529.

Sasha reported that this causes problems, so revert it.

Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6dc01aa6
...@@ -54,8 +54,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp) ...@@ -54,8 +54,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
wake_up_interruptible(&tty->link->write_wait); wake_up_interruptible(&tty->link->write_wait);
if (tty->driver->subtype == PTY_TYPE_MASTER) { if (tty->driver->subtype == PTY_TYPE_MASTER) {
set_bit(TTY_OTHER_CLOSED, &tty->flags); set_bit(TTY_OTHER_CLOSED, &tty->flags);
tty_unlock();
devpts_pty_kill(tty->link); devpts_pty_kill(tty->link);
tty_unlock();
tty_vhangup(tty->link); tty_vhangup(tty->link);
tty_lock(); tty_lock();
} }
...@@ -613,7 +613,9 @@ static int ptmx_open(struct inode *inode, struct file *filp) ...@@ -613,7 +613,9 @@ static int ptmx_open(struct inode *inode, struct file *filp)
return retval; return retval;
/* find a device that is not in use. */ /* find a device that is not in use. */
tty_lock();
index = devpts_new_index(inode); index = devpts_new_index(inode);
tty_unlock();
if (index < 0) { if (index < 0) {
retval = index; retval = index;
goto err_file; goto err_file;
...@@ -648,8 +650,8 @@ static int ptmx_open(struct inode *inode, struct file *filp) ...@@ -648,8 +650,8 @@ static int ptmx_open(struct inode *inode, struct file *filp)
tty_release(inode, filp); tty_release(inode, filp);
return retval; return retval;
out: out:
tty_unlock();
devpts_kill_index(inode, index); devpts_kill_index(inode, index);
tty_unlock();
err_file: err_file:
tty_free_file(filp); tty_free_file(filp);
return retval; return retval;
......
...@@ -1789,11 +1789,11 @@ int tty_release(struct inode *inode, struct file *filp) ...@@ -1789,11 +1789,11 @@ int tty_release(struct inode *inode, struct file *filp)
* the slots and preserving the termios structure. * the slots and preserving the termios structure.
*/ */
release_tty(tty, idx); release_tty(tty, idx);
tty_unlock();
/* Make this pty number available for reallocation */ /* Make this pty number available for reallocation */
if (devpts) if (devpts)
devpts_kill_index(inode, idx); devpts_kill_index(inode, idx);
tty_unlock();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment