From 7c6d401c7516fbdc7781c09d0537a0bae3146a1c Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Thu, 9 Jul 2009 18:54:38 +0000 Subject: The control terminal revocation at the session leader exit does not correctly checks for reclaimed vnode, possibly calling VOP_REVOKE for such vnode. If the terminal is already revoked, or devfs mount was forcibly unmounted, the revocation of doomed ctty vnode causes panic. Reported and tested by: lstewart Approved by: re (kensmith) MFC after: 2 weeks --- sys/kern/kern_exit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/kern/kern_exit.c') diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 450aab602cc3..cb6e7b28fa48 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -334,10 +334,11 @@ exit1(struct thread *td, int rv) tty_unlock(tp); } - if (ttyvp != NULL && ttyvp->v_type != VBAD) { + if (ttyvp != NULL) { sx_xunlock(&proctree_lock); - VOP_LOCK(ttyvp, LK_EXCLUSIVE); - VOP_REVOKE(ttyvp, REVOKEALL); + vn_lock(ttyvp, LK_EXCLUSIVE | LK_RETRY); + if (ttyvp->v_type != VBAD) + VOP_REVOKE(ttyvp, REVOKEALL); VOP_UNLOCK(ttyvp, 0); sx_xlock(&proctree_lock); } -- cgit v1.2.3