svn commit: r332197 - stable/11/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Sat Apr 7 19:09:52 UTC 2018
Author: tuexen
Date: Sat Apr 7 19:09:51 2018
New Revision: 332197
URL: https://svnweb.freebsd.org/changeset/base/332197
Log:
MFC r323833:
Protect the address workqueue timer by a mutex.
Modified:
stable/11/sys/netinet/sctp_pcb.c
stable/11/sys/netinet/sctputil.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 18:58:58 2018 (r332196)
+++ stable/11/sys/netinet/sctp_pcb.c Sat Apr 7 19:09:51 2018 (r332197)
@@ -709,12 +709,11 @@ sctp_add_addr_to_vrf(uint32_t vrf_id, void *ifn, uint3
SCTP_WQ_ADDR_LOCK();
LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr);
- SCTP_WQ_ADDR_UNLOCK();
-
sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
(struct sctp_inpcb *)NULL,
(struct sctp_tcb *)NULL,
(struct sctp_nets *)NULL);
+ SCTP_WQ_ADDR_UNLOCK();
} else {
/* it's ready for use */
sctp_ifap->localifa_flags &= ~SCTP_ADDR_DEFER_USE;
@@ -821,12 +820,11 @@ out_now:
* the newest first :-0
*/
LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr);
- SCTP_WQ_ADDR_UNLOCK();
-
sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
(struct sctp_inpcb *)NULL,
(struct sctp_tcb *)NULL,
(struct sctp_nets *)NULL);
+ SCTP_WQ_ADDR_UNLOCK();
}
return;
}
Modified: stable/11/sys/netinet/sctputil.c
==============================================================================
--- stable/11/sys/netinet/sctputil.c Sat Apr 7 18:58:58 2018 (r332196)
+++ stable/11/sys/netinet/sctputil.c Sat Apr 7 19:09:51 2018 (r332197)
@@ -1462,13 +1462,11 @@ sctp_handle_addr_wq(void)
LIST_INIT(&asc->list_of_work);
asc->cnt = 0;
- SCTP_WQ_ADDR_LOCK();
LIST_FOREACH_SAFE(wi, &SCTP_BASE_INFO(addr_wq), sctp_nxt_addr, nwi) {
LIST_REMOVE(wi, sctp_nxt_addr);
LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr);
asc->cnt++;
}
- SCTP_WQ_ADDR_UNLOCK();
if (asc->cnt == 0) {
SCTP_FREE(asc, SCTP_M_ASC_IT);
@@ -1492,11 +1490,9 @@ sctp_handle_addr_wq(void)
if (SCTP_BASE_VAR(sctp_pcb_initialized) == 0) {
sctp_asconf_iterator_end(asc, 0);
} else {
- SCTP_WQ_ADDR_LOCK();
LIST_FOREACH(wi, &asc->list_of_work, sctp_nxt_addr) {
LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr);
}
- SCTP_WQ_ADDR_UNLOCK();
SCTP_FREE(asc, SCTP_M_ASC_IT);
}
}
@@ -1565,8 +1561,7 @@ sctp_timeout_handler(void *t)
(tmr->type != SCTP_TIMER_TYPE_SHUTDOWN) &&
(tmr->type != SCTP_TIMER_TYPE_SHUTDOWNACK) &&
(tmr->type != SCTP_TIMER_TYPE_SHUTDOWNGUARD) &&
- (tmr->type != SCTP_TIMER_TYPE_ASOCKILL))
- ) {
+ (tmr->type != SCTP_TIMER_TYPE_ASOCKILL))) {
SCTP_INP_DECR_REF(inp);
CURVNET_RESTORE();
return;
@@ -1612,6 +1607,12 @@ sctp_timeout_handler(void *t)
CURVNET_RESTORE();
return;
}
+ } else if (inp != NULL) {
+ if (type != SCTP_TIMER_TYPE_INPKILL) {
+ SCTP_INP_WLOCK(inp);
+ }
+ } else {
+ SCTP_WQ_ADDR_LOCK();
}
/* record in stopped what t-o occurred */
tmr->stopped_from = type;
@@ -1759,7 +1760,6 @@ sctp_timeout_handler(void *t)
}
SCTP_STAT_INCR(sctps_timosecret);
(void)SCTP_GETTIME_TIMEVAL(&tv);
- SCTP_INP_WLOCK(inp);
inp->sctp_ep.time_of_secret_change = tv.tv_sec;
inp->sctp_ep.last_secret_number =
inp->sctp_ep.current_secret_number;
@@ -1773,7 +1773,6 @@ sctp_timeout_handler(void *t)
inp->sctp_ep.secret_key[secret][i] =
sctp_select_initial_TSN(&inp->sctp_ep);
}
- SCTP_INP_WUNLOCK(inp);
sctp_timer_start(SCTP_TIMER_TYPE_NEWCOOKIE, inp, stcb, net);
}
did_output = 0;
@@ -1921,7 +1920,12 @@ sctp_timeout_handler(void *t)
get_out:
if (stcb) {
SCTP_TCB_UNLOCK(stcb);
+ } else if (inp != NULL) {
+ SCTP_INP_WUNLOCK(inp);
+ } else {
+ SCTP_WQ_ADDR_UNLOCK();
}
+
out_decr:
if (inp) {
SCTP_INP_DECR_REF(inp);
@@ -6145,11 +6149,11 @@ sctp_dynamic_set_primary(struct sockaddr *sa, uint32_t
* newest first :-0
*/
LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr);
- SCTP_WQ_ADDR_UNLOCK();
sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ,
(struct sctp_inpcb *)NULL,
(struct sctp_tcb *)NULL,
(struct sctp_nets *)NULL);
+ SCTP_WQ_ADDR_UNLOCK();
return (0);
}
More information about the svn-src-stable
mailing list