diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -340,7 +340,8 @@ } } - if (CC_ALGO(tp)->ack_received != NULL) { + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->ack_received != NULL) { /* XXXLAS: Find a way to live without this */ tp->t_ccv.curack = th->th_ack; CC_ALGO(tp)->ack_received(&tp->t_ccv, type); @@ -401,7 +402,8 @@ else tp->snd_cwnd = tcp_compute_initwnd(maxseg); - if (CC_ALGO(tp)->conn_init != NULL) + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->conn_init != NULL) CC_ALGO(tp)->conn_init(&tp->t_ccv); } @@ -462,7 +464,8 @@ break; } - if (CC_ALGO(tp)->cong_signal != NULL) { + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->cong_signal != NULL) { if (th != NULL) tp->t_ccv.curack = th->th_ack; CC_ALGO(tp)->cong_signal(&tp->t_ccv, type); @@ -474,7 +477,8 @@ { INP_WLOCK_ASSERT(tptoinpcb(tp)); - if (CC_ALGO(tp)->post_recovery != NULL) { + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->post_recovery != NULL) { tp->t_ccv.curack = th->th_ack; CC_ALGO(tp)->post_recovery(&tp->t_ccv); } @@ -506,7 +510,8 @@ { INP_WLOCK_ASSERT(tptoinpcb(tp)); - if (CC_ALGO(tp)->ecnpkt_handler != NULL) { + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->ecnpkt_handler != NULL) { switch (iptos & IPTOS_ECN_MASK) { case IPTOS_ECN_CE: tp->t_ccv.flags |= CCF_IPHDR_CE; diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -178,7 +178,8 @@ { INP_WLOCK_ASSERT(tptoinpcb(tp)); - if (CC_ALGO(tp)->after_idle != NULL) + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->after_idle != NULL) CC_ALGO(tp)->after_idle(&tp->t_ccv); } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2401,7 +2401,7 @@ #endif /* Allow the CC algorithm to clean up after itself. */ - if (CC_ALGO(tp)->cb_destroy != NULL) + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->cb_destroy != NULL) CC_ALGO(tp)->cb_destroy(&tp->t_ccv); CC_DATA(tp) = NULL; /* Detach from the CC algorithm */ diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -742,7 +742,8 @@ * Reset the slow-start flight size * as it may depend on the new MSS. */ - if (CC_ALGO(tp)->conn_init != NULL) + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->conn_init != NULL) CC_ALGO(tp)->conn_init(&tp->t_ccv); } else { /* @@ -761,7 +762,8 @@ * Reset the slow-start flight size as it * may depend on the new MSS. */ - if (CC_ALGO(tp)->conn_init != NULL) + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->conn_init != NULL) CC_ALGO(tp)->conn_init(&tp->t_ccv); } } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -2031,7 +2031,8 @@ * copying in the cc_mem after we call * the old ones cleanup (if any). */ - if (CC_ALGO(tp)->cb_destroy != NULL) + KASSERT(CC_ALGO(tp) != NULL, ("CC algo is NULL\n")); + if (CC_ALGO(tp) != NULL && CC_ALGO(tp)->cb_destroy != NULL) CC_ALGO(tp)->cb_destroy(&tp->t_ccv); /* Detach the old CC from the tcpcb */ cc_detach(tp);