PERFORCE change 42175 for review

Sam Leffler sam at FreeBSD.org
Wed Nov 12 14:29:26 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=42175

Change 42175 by sam at sam_ebb on 2003/11/12 14:28:49

	o shuffle lock assertions so they reflect the order the locks
	  are to be taken
	o add missing inpcb lock required before destroying the inpcb
	  mutex in tcp_twclose

Affected files ...

.. //depot/projects/netperf/sys/netinet/in_pcb.c#15 edit

Differences ...

==== //depot/projects/netperf/sys/netinet/in_pcb.c#15 (text+ko) ====

@@ -208,9 +208,9 @@
 {
 	int anonport, error;
 
+	INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
 	INP_LOCK_ASSERT(inp);
 
-	INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo);
 	if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY)
 		return (EINVAL);
 	anonport = inp->inp_lport == 0 && (nam == NULL ||
@@ -255,9 +255,9 @@
 	int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
 	int error, prison = 0;
 
+	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	INP_LOCK_ASSERT(inp);
 
-	INP_INFO_WLOCK_ASSERT(pcbinfo);
 	if (TAILQ_EMPTY(&in_ifaddrhead)) /* XXX broken! */
 		return (EADDRNOTAVAIL);
 	laddr.s_addr = *laddrp;
@@ -939,7 +939,8 @@
 	int matchwild = 3, wildcard;
 	u_short lport = lport_arg;
 
-	INP_INFO_RLOCK_ASSERT(pcbinfo);
+	INP_INFO_WLOCK_ASSERT(pcbinfo);
+
 	if (!wild_okay) {
 		struct inpcbhead *head;
 		/*
@@ -999,6 +1000,7 @@
 				 */
 				if ((inp->inp_vflag & INP_TIMEWAIT) != 0) {
 					if (tcp_twrecycleable((struct tcptw *)inp->inp_ppcb)) {
+						INP_LOCK(inp);
 						tcp_twclose((struct tcptw *)inp->inp_ppcb, 0);
 						match = NULL;
 						goto retrylookup;


More information about the p4-projects mailing list