svn commit: r195509 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu Jul 9 18:54:40 UTC 2009


Author: kib
Date: Thu Jul  9 18:54:38 2009
New Revision: 195509
URL: http://svn.freebsd.org/changeset/base/195509

Log:
  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

Modified:
  head/sys/kern/kern_exit.c

Modified: head/sys/kern/kern_exit.c
==============================================================================
--- head/sys/kern/kern_exit.c	Thu Jul  9 18:49:26 2009	(r195508)
+++ head/sys/kern/kern_exit.c	Thu Jul  9 18:54:38 2009	(r195509)
@@ -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);
 		}


More information about the svn-src-all mailing list