diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-12-05 22:27:53 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-12-05 22:27:53 +0000 |
commit | a12b213cad178436bbc1475d01f6bc93f197db3b (patch) | |
tree | 642a08ff382033a47a5a61d0b54c345befebee77 /sys/netinet | |
parent | 386bd91d54ddaa1fc8aa0a90c7198329966e5eac (diff) | |
download | FreeBSD-src-a12b213cad178436bbc1475d01f6bc93f197db3b.zip FreeBSD-src-a12b213cad178436bbc1475d01f6bc93f197db3b.tar.gz |
Assert inpcb lock in:
tcpip_fillheaders()
tcp_discardcb()
tcp_close()
tcp_notify()
tcp_new_isn()
tcp_xmit_bandwidth_limit()
Fix a locking comment in tcp_twstart(): the pcbinfo will be locked (and
is asserted).
MFC after: 2 weeks
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_subr.c | 13 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 13 |
2 files changed, 24 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 32044e4..0491f4f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -319,6 +319,8 @@ tcpip_fillheaders(inp, ip_ptr, tcp_ptr) { struct tcphdr *th = (struct tcphdr *)tcp_ptr; + INP_LOCK_ASSERT(inp); + #ifdef INET6 if ((inp->inp_vflag & INP_IPV6) != 0) { struct ip6_hdr *ip6; @@ -670,6 +672,8 @@ tcp_discardcb(tp) int isipv6 = (inp->inp_vflag & INP_IPV6) != 0; #endif /* INET6 */ + INP_LOCK_ASSERT(inp); + /* * Make sure that all of our timers are stopped before we * delete the PCB. @@ -765,6 +769,8 @@ tcp_close(tp) struct socket *so = inp->inp_socket; #endif + INP_LOCK_ASSERT(inp); + tcp_discardcb(tp); #ifdef INET6 if (INP_CHECK_SOCKAF(so, AF_INET6)) @@ -829,6 +835,8 @@ tcp_notify(inp, error) { struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb; + INP_LOCK_ASSERT(inp); + /* * Ignore some errors if we are hooked up. * If connection hasn't completed, has retransmitted several times, @@ -1305,6 +1313,7 @@ tcp_new_isn(tp) tcp_seq new_isn; INP_INFO_WLOCK_ASSERT(&tcbinfo); + INP_LOCK_ASSERT(tp->t_inpcb); /* Seed if this is the first use, reseed if requested. */ if ((isn_last_reseed == 0) || ((tcp_isn_reseed_interval > 0) && @@ -1612,7 +1621,7 @@ ipsec_hdrsiz_tcp(tp) /* * Move a TCP connection into TIME_WAIT state. - * tcbinfo is unlocked. + * tcbinfo is locked. * inp is locked, and is unlocked before returning. */ void @@ -1898,6 +1907,8 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq) u_long bwnd; int save_ticks; + INP_LOCK_ASSERT(tp->t_inpcb); + /* * If inflight_enable is disabled in the middle of a tcp connection, * make sure snd_bwnd is effectively disabled. diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 32044e4..0491f4f 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -319,6 +319,8 @@ tcpip_fillheaders(inp, ip_ptr, tcp_ptr) { struct tcphdr *th = (struct tcphdr *)tcp_ptr; + INP_LOCK_ASSERT(inp); + #ifdef INET6 if ((inp->inp_vflag & INP_IPV6) != 0) { struct ip6_hdr *ip6; @@ -670,6 +672,8 @@ tcp_discardcb(tp) int isipv6 = (inp->inp_vflag & INP_IPV6) != 0; #endif /* INET6 */ + INP_LOCK_ASSERT(inp); + /* * Make sure that all of our timers are stopped before we * delete the PCB. @@ -765,6 +769,8 @@ tcp_close(tp) struct socket *so = inp->inp_socket; #endif + INP_LOCK_ASSERT(inp); + tcp_discardcb(tp); #ifdef INET6 if (INP_CHECK_SOCKAF(so, AF_INET6)) @@ -829,6 +835,8 @@ tcp_notify(inp, error) { struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb; + INP_LOCK_ASSERT(inp); + /* * Ignore some errors if we are hooked up. * If connection hasn't completed, has retransmitted several times, @@ -1305,6 +1313,7 @@ tcp_new_isn(tp) tcp_seq new_isn; INP_INFO_WLOCK_ASSERT(&tcbinfo); + INP_LOCK_ASSERT(tp->t_inpcb); /* Seed if this is the first use, reseed if requested. */ if ((isn_last_reseed == 0) || ((tcp_isn_reseed_interval > 0) && @@ -1612,7 +1621,7 @@ ipsec_hdrsiz_tcp(tp) /* * Move a TCP connection into TIME_WAIT state. - * tcbinfo is unlocked. + * tcbinfo is locked. * inp is locked, and is unlocked before returning. */ void @@ -1898,6 +1907,8 @@ tcp_xmit_bandwidth_limit(struct tcpcb *tp, tcp_seq ack_seq) u_long bwnd; int save_ticks; + INP_LOCK_ASSERT(tp->t_inpcb); + /* * If inflight_enable is disabled in the middle of a tcp connection, * make sure snd_bwnd is effectively disabled. |