Skip to contentSkip to conversation

tty: drop the pty lock during hangup

PATCH New Alan Cox 1 participant 1 message May 9, 2012 TTY layer and serial drivers

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 tty: drop the pty lock during hangup

From: Alan Cox <[email protected]>

In theory we don't need it, in practice we are hitting some ill understood deadlock when we don't drop it. The old code dropped it here so we are not undoing anything problematic for pty. If pty could be unloaded it would be a problem but it can't.

---

 drivers/tty/pty.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/tty/pty.c +2 -0
index d6fa842..59af394 100644
@@ -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);
 	}
 }