svn commit: r208876 - head/sys/netinet

Randall Stewart rrs at FreeBSD.org
Sun Jun 6 16:11:17 UTC 2010


Author: rrs
Date: Sun Jun  6 16:11:16 2010
New Revision: 208876
URL: http://svn.freebsd.org/changeset/base/208876

Log:
  1) Further enhance the INVARIANT lock validation (no locks) are
     held by checking the create and inp locks as well.
  
  2) Fix a bug in that when a socket is closed an INIT-ACK
     is returned, we do NOT unlock the locked_tcb unless its
     different (an unlikely scenario). If we blindly unlock as
     we were doing before we can end up unlocking the actual
     stcb thats about to be sent down to the free function which
     requires the lock be held.
  
  MFC after:	1 week

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==============================================================================
--- head/sys/netinet/sctp_input.c	Sun Jun  6 16:09:12 2010	(r208875)
+++ head/sys/netinet/sctp_input.c	Sun Jun  6 16:11:16 2010	(r208876)
@@ -4534,7 +4534,8 @@ process_control_chunks:
 				if ((stcb) && (stcb->asoc.total_output_queue_size)) {
 					;
 				} else {
-					if (locked_tcb) {
+					if (locked_tcb != stcb) {
+						/* Very unlikely */
 						SCTP_TCB_UNLOCK(locked_tcb);
 					}
 					*offset = length;
@@ -5424,6 +5425,12 @@ __attribute__((noinline))
 			panic("Own lock on stcb at return from input");
 		}
 	}
+	if (mtx_owned(&inp->inp_create_mtx)) {
+		panic("Own create lock on inp");
+	}
+	if (mtx_owned(&inp->inp_mtx)) {
+		panic("Own inp lock on inp");
+	}
 }
 
 #endif


More information about the svn-src-all mailing list