diff options
author | Richard Scheffenegger <rscheff@FreeBSD.org> | 2024-02-10 09:28:42 +0000 |
---|---|---|
committer | Richard Scheffenegger <rscheff@FreeBSD.org> | 2024-02-10 09:30:00 +0000 |
commit | 62d47d73b7eb01f3b0a37541df5e7aaa36f54335 (patch) | |
tree | 5e5a964d577d7ed052e64f105714530d31f81c08 | |
parent | a8e817cf5c9c6e34357e0c078a256e2526b9da53 (diff) | |
download | src-62d47d73b7eb01f3b0a37541df5e7aaa36f54335.tar.gz src-62d47d73b7eb01f3b0a37541df5e7aaa36f54335.zip |
tcp: stop timers and clean scoreboard in tcp_close()
Stop timers when in tcp_close() instead of doing that in tcp_discardcb().
A connection in CLOSED state shall not need any timers. Assert that no
timer is rescheduled after that in tcp_timer_activate() and verfiy that
this is also the expected state in tcp_discardcb().
PR: 276761
Reviewed By: glebius, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D43792
-rw-r--r-- | sys/netinet/tcp_subr.c | 4 | ||||
-rw-r--r-- | sys/netinet/tcp_timer.c | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 6043a3d458e5..90e1496a822c 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -2383,10 +2383,9 @@ tcp_discardcb(struct tcpcb *tp) #endif INP_WLOCK_ASSERT(inp); + MPASS(!callout_active(&tp->t_callout)); MPASS(TAILQ_EMPTY(&tp->snd_holes)); - tcp_timer_stop(tp); - /* free the reassembly queue, if any */ tcp_reass_flush(tp); @@ -2522,6 +2521,7 @@ tcp_close(struct tcpcb *tp) tcp_fastopen_decrement_counter(tp->t_tfo_pending); tp->t_tfo_pending = NULL; } + tcp_timer_stop(tp); if (tp->t_fb->tfb_tcp_timer_stop_all != NULL) tp->t_fb->tfb_tcp_timer_stop_all(tp); in_pcbdrop(inp); diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index f0eb3bad33cf..ed50659abf8e 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -907,6 +907,7 @@ tcp_timer_activate(struct tcpcb *tp, tt_which which, u_int delta) #endif INP_WLOCK_ASSERT(inp); + MPASS(tp->t_state > TCPS_CLOSED); if (delta > 0) { what = TT_STARTING; |