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 @@ -1520,22 +1520,15 @@ 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 @@ 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 @@ save_start + tlen); } } - tcp_handle_wakeup(tp, so); + tcp_handle_wakeup(tp); #if 0 /* * Note the amount of data that peer has sent into diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1099,7 +1099,6 @@ 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);