Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Jun 2010 16:11:17 +0000 (UTC)
From:      Randall Stewart <rrs@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208876 - head/sys/netinet
Message-ID:  <201006061611.o56GBHbE089883@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006061611.o56GBHbE089883>