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

This reverts commit d3bda5298aad98c7a27678bdd0dd9d008ab9e685.

Sasha reported that this causes problems, so revert it.

Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index ea7ebe2..44736f9 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1789,11 +1789,11 @@
 	 * the slots and preserving the termios structure.
 	 */
 	release_tty(tty, idx);
-	tty_unlock();
 
 	/* Make this pty number available for reallocation */
 	if (devpts)
 		devpts_kill_index(inode, idx);
+	tty_unlock();
 	return 0;
 }