diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index d6fa8429f3ff247527edeccb31d9653b29f0ba54..59af3945ea859c334719fed6a41b4192a30f87f5 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -63,7 +63,9 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 		        mutex_unlock(&devpts_mutex);
 		}
 #endif
+		tty_unlock(tty);
 		tty_vhangup(tty->link);
+		tty_lock(tty);
 	}
 }