From 856ebf85302f8cb261cc639b1540a1f496260b8a Mon Sep 17 00:00:00 2001 From: "Christian S.J. Peron" Date: Wed, 10 Sep 2008 20:12:10 +0000 Subject: [PATCH] Make sure the TTY has not disappeared out from under us before calling ttydevsw_outwakeup(). This should fix panics which occur after remote login sessions timeout during moderate TTY activity. An example of where this might occur is where a pending write to the terminal is occurring while sshd(8) is shutting down the TTY after a TCP timeout. Submitted by: ed --- sys/kern/tty_ttydisc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/tty_ttydisc.c b/sys/kern/tty_ttydisc.c index 1bcdfd6fc50b..21c029b498ad 100644 --- a/sys/kern/tty_ttydisc.c +++ b/sys/kern/tty_ttydisc.c @@ -539,8 +539,9 @@ ttydisc_write(struct tty *tp, struct uio *uio, int ioflag) } while (oblen > 0); } -done: - ttydevsw_outwakeup(tp); +done: + if (!tty_gone(tp)) + ttydevsw_outwakeup(tp); /* * Add the amount of bytes that we didn't process back to the