aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2020-05-07 03:17:52 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2020-05-07 03:17:52 +0000
commit2f55bf9529b8450bfc8eecc730239790732163cd (patch)
tree22f3e9632bb750983cee2f41ed7e17d4e1fd5d5d
parent7f2cfa45f4c970bd5147a1dac069dc7cbfe8147d (diff)
downloadsrc-2f55bf9529b8450bfc8eecc730239790732163cd.tar.gz
src-2f55bf9529b8450bfc8eecc730239790732163cd.zip
MFC r357768: Optimize timer starting
Don't start an SCTP timer using a net, which has been removed. Submitted by: Taylor Brandstetter
Notes
Notes: svn path=/stable/11/; revision=360763
-rw-r--r--sys/netinet/sctp_pcb.c1
-rw-r--r--sys/netinet/sctputil.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/sys/netinet/sctp_pcb.c b/sys/netinet/sctp_pcb.c
index 90d582fc4566..4f68c215f5e8 100644
--- a/sys/netinet/sctp_pcb.c
+++ b/sys/netinet/sctp_pcb.c
@@ -4483,6 +4483,7 @@ out:
SCTP_FROM_SCTP_PCB + SCTP_LOC_9);
sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
SCTP_FROM_SCTP_PCB + SCTP_LOC_10);
+ net->dest_state |= SCTP_ADDR_BEING_DELETED;
sctp_free_remote_addr(net);
}
diff --git a/sys/netinet/sctputil.c b/sys/netinet/sctputil.c
index 07d0f8321ad2..d1ccd451da8e 100644
--- a/sys/netinet/sctputil.c
+++ b/sys/netinet/sctputil.c
@@ -2047,6 +2047,10 @@ sctp_timer_start(int t_type, struct sctp_inpcb *inp, struct sctp_tcb *stcb,
if (stcb) {
SCTP_TCB_LOCK_ASSERT(stcb);
}
+ /* Don't restart timer on net that's been removed. */
+ if (net != NULL && (net->dest_state & SCTP_ADDR_BEING_DELETED)) {
+ return;
+ }
switch (t_type) {
case SCTP_TIMER_TYPE_ADDR_WQ:
/* Only 1 tick away :-) */