summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/netinet/tcp_subr.c13
-rw-r--r--sys/netinet/tcp_timewait.c13
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.
OpenPOWER on IntegriCloud