tcp: make tcp_handle_wakeup() static and robust

It is called only from tcp_input() and always has valid parameter.

Reviewed by:		rscheff, tuexen
Differential revision:	https://reviews.freebsd.org/D37115
This commit is contained in:
Gleb Smirnoff 2022-10-31 08:57:15 -07:00
parent 19acc50667
commit c348e88053
2 changed files with 9 additions and 17 deletions

View File

@ -1520,22 +1520,15 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
return(tcp_input_with_port(mp, offp, proto, 0));
}
void
tcp_handle_wakeup(struct tcpcb *tp, struct socket *so)
static void
tcp_handle_wakeup(struct tcpcb *tp)
{
/*
* Since tp might be gone if the session entered
* the TIME_WAIT state before coming here, we need
* to check if the socket is still connected.
*/
if (tp == NULL) {
return;
}
if (so == NULL) {
return;
}
INP_LOCK_ASSERT(tp->t_inpcb);
INP_WLOCK_ASSERT(tp->t_inpcb);
if (tp->t_flags & TF_WAKESOR) {
struct socket *so = tp->t_inpcb->inp_socket;
tp->t_flags &= ~TF_WAKESOR;
SOCKBUF_LOCK_ASSERT(&so->so_rcv);
sorwakeup_locked(so);
@ -2521,7 +2514,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
if (tlen == 0 && (thflags & TH_FIN) == 0) {
(void) tcp_reass(tp, (struct tcphdr *)0, NULL, 0,
(struct mbuf *)0);
tcp_handle_wakeup(tp, so);
tcp_handle_wakeup(tp);
}
tp->snd_wl1 = th->th_seq - 1;
/* FALLTHROUGH */
@ -3258,7 +3251,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
save_start + tlen);
}
}
tcp_handle_wakeup(tp, so);
tcp_handle_wakeup(tp);
#if 0
/*
* Note the amount of data that peer has sent into

View File

@ -1099,7 +1099,6 @@ int tcp_input(struct mbuf **, int *, int);
int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *,
struct tcpcb *, int);
int tcp_input_with_port(struct mbuf **, int *, int, uint16_t);
void tcp_handle_wakeup(struct tcpcb *, struct socket *);
void tcp_do_segment(struct mbuf *, struct tcphdr *,
struct socket *, struct tcpcb *, int, int, uint8_t);