summary refs log tree commit diff
path: root/drivers/tty/pty.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2012-01-30 21:14:32 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-02 15:10:46 -0800
commitd3bda5298aad98c7a27678bdd0dd9d008ab9e685 (patch)
tree40b098fd53e4f811277e9e215ec477c3da2856ea /drivers/tty/pty.c
parenta50f724a432997321cabb6c9e665c28e34850f78 (diff)
downloadlinux-d3bda5298aad98c7a27678bdd0dd9d008ab9e685.tar.gz
TTY: get rid of BTM around devpts_*
devpts operations are protected by inode mutexes and dentry
refcounting. There is no need to hold BTM.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/pty.c')
-rw-r--r--drivers/tty/pty.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index ddec9f3c3396..39afd045f8ef 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -54,8 +54,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 	wake_up_interruptible(&tty->link->write_wait);
 	if (tty->driver->subtype == PTY_TYPE_MASTER) {
 		set_bit(TTY_OTHER_CLOSED, &tty->flags);
-		devpts_pty_kill(tty->link);
 		tty_unlock();
+		devpts_pty_kill(tty->link);
 		tty_vhangup(tty->link);
 		tty_lock();
 	}
@@ -613,9 +613,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
 		return retval;
 
 	/* find a device that is not in use. */
-	tty_lock();
 	index = devpts_new_index(inode);
-	tty_unlock();
 	if (index < 0) {
 		retval = index;
 		goto err_file;
@@ -650,8 +648,8 @@ err_release:
 	tty_release(inode, filp);
 	return retval;
 out:
-	devpts_kill_index(inode, index);
 	tty_unlock();
+	devpts_kill_index(inode, index);
 err_file:
 	tty_free_file(filp);
 	return retval;