Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 2003 14:29:24 -0800 (PST)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 42175 for review
Message-ID:  <200311122229.hACMTO4R027128@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=42175

Change 42175 by sam@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;



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