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
This commit is contained in:
Robert Watson 2004-12-05 22:27:53 +00:00
parent 6fbed4af22
commit b9155d92b2
2 changed files with 24 additions and 2 deletions

View File

@ -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.

View File

@ -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.