summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-10-26 22:03:52 +0000
committerrwatson <rwatson@FreeBSD.org>2008-10-26 22:03:52 +0000
commit879c5460c084672911baf77e5c9d3b7094e4d2ff (patch)
treea3c553c0ae5dffbf0f760266cbb26de4491b92ed /sys
parent55988186e03ee2cfbbf589ad56e817cf620a4c68 (diff)
downloadFreeBSD-src-879c5460c084672911baf77e5c9d3b7094e4d2ff.zip
FreeBSD-src-879c5460c084672911baf77e5c9d3b7094e4d2ff.tar.gz
In both dropwithreset paths in tcp_input.c, drop the tcbinfo lock
sooner to decomplicate locking and eliminate the need for a rather chatty comment about why we have to handle the global lock in a special way for the benefit of ipfw and pf cred rules. MFC after: 3 days
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_input.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 1284376..1e59c1b 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -896,19 +896,12 @@ findpcb:
dropwithreset:
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
+ INP_INFO_WUNLOCK(&V_tcbinfo);
- /*
- * If inp is non-NULL, we call tcp_dropwithreset() holding both inpcb
- * and global locks. However, if NULL, we must hold neither as
- * firewalls may acquire the global lock in order to look for a
- * matching inpcb.
- */
if (inp != NULL) {
tcp_dropwithreset(m, th, tp, tlen, rstreason);
INP_WUNLOCK(inp);
- }
- INP_INFO_WUNLOCK(&V_tcbinfo);
- if (inp == NULL)
+ } else
tcp_dropwithreset(m, th, NULL, tlen, rstreason);
m = NULL; /* mbuf chain got consumed. */
goto drop;
@@ -2498,19 +2491,12 @@ dropafterack:
dropwithreset:
KASSERT(headlocked, ("%s: dropwithreset: head not locked", __func__));
+ INP_INFO_WUNLOCK(&V_tcbinfo);
- /*
- * If tp is non-NULL, we call tcp_dropwithreset() holding both inpcb
- * and global locks. However, if NULL, we must hold neither as
- * firewalls may acquire the global lock in order to look for a
- * matching inpcb.
- */
if (tp != NULL) {
tcp_dropwithreset(m, th, tp, tlen, rstreason);
INP_WUNLOCK(tp->t_inpcb);
- }
- INP_INFO_WUNLOCK(&V_tcbinfo);
- if (tp == NULL)
+ } else
tcp_dropwithreset(m, th, NULL, tlen, rstreason);
return;
OpenPOWER on IntegriCloud