Store the timer type for logging, because the timer can be freed

during processing the timerout.

MFC after:	3 days
This commit is contained in:
Michael Tuexen 2016-01-13 14:28:12 +00:00
parent a53b7c692d
commit fa89f69240

View File

@ -1495,6 +1495,7 @@ sctp_timeout_handler(void *t)
#endif #endif
int did_output; int did_output;
int type;
tmr = (struct sctp_timer *)t; tmr = (struct sctp_timer *)t;
inp = (struct sctp_inpcb *)tmr->ep; inp = (struct sctp_inpcb *)tmr->ep;
@ -1563,8 +1564,9 @@ sctp_timeout_handler(void *t)
return; return;
} }
} }
type = tmr->type;
tmr->stopped_from = 0xa005; tmr->stopped_from = 0xa005;
SCTPDBG(SCTP_DEBUG_TIMER1, "Timer type %d goes off\n", tmr->type); SCTPDBG(SCTP_DEBUG_TIMER1, "Timer type %d goes off\n", type);
if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) { if (!SCTP_OS_TIMER_ACTIVE(&tmr->timer)) {
if (inp) { if (inp) {
SCTP_INP_DECR_REF(inp); SCTP_INP_DECR_REF(inp);
@ -1580,7 +1582,7 @@ sctp_timeout_handler(void *t)
if (stcb) { if (stcb) {
SCTP_TCB_LOCK(stcb); SCTP_TCB_LOCK(stcb);
atomic_add_int(&stcb->asoc.refcnt, -1); atomic_add_int(&stcb->asoc.refcnt, -1);
if ((tmr->type != SCTP_TIMER_TYPE_ASOCKILL) && if ((type != SCTP_TIMER_TYPE_ASOCKILL) &&
((stcb->asoc.state == 0) || ((stcb->asoc.state == 0) ||
(stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED))) { (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED))) {
SCTP_TCB_UNLOCK(stcb); SCTP_TCB_UNLOCK(stcb);
@ -1592,7 +1594,7 @@ sctp_timeout_handler(void *t)
} }
} }
/* record in stopped what t-o occured */ /* record in stopped what t-o occured */
tmr->stopped_from = tmr->type; tmr->stopped_from = type;
/* mark as being serviced now */ /* mark as being serviced now */
if (SCTP_OS_TIMER_PENDING(&tmr->timer)) { if (SCTP_OS_TIMER_PENDING(&tmr->timer)) {
@ -1610,7 +1612,7 @@ sctp_timeout_handler(void *t)
SCTP_OS_TIMER_DEACTIVATE(&tmr->timer); SCTP_OS_TIMER_DEACTIVATE(&tmr->timer);
/* call the handler for the appropriate timer type */ /* call the handler for the appropriate timer type */
switch (tmr->type) { switch (type) {
case SCTP_TIMER_TYPE_ZERO_COPY: case SCTP_TIMER_TYPE_ZERO_COPY:
if (inp == NULL) { if (inp == NULL) {
break; break;
@ -1894,11 +1896,11 @@ sctp_timeout_handler(void *t)
goto out_no_decr; goto out_no_decr;
default: default:
SCTPDBG(SCTP_DEBUG_TIMER1, "sctp_timeout_handler:unknown timer %d\n", SCTPDBG(SCTP_DEBUG_TIMER1, "sctp_timeout_handler:unknown timer %d\n",
tmr->type); type);
break; break;
} }
#ifdef SCTP_AUDITING_ENABLED #ifdef SCTP_AUDITING_ENABLED
sctp_audit_log(0xF1, (uint8_t) tmr->type); sctp_audit_log(0xF1, (uint8_t) type);
if (inp) if (inp)
sctp_auditing(5, inp, stcb, net); sctp_auditing(5, inp, stcb, net);
#endif #endif
@ -1921,8 +1923,7 @@ out_decr:
SCTP_INP_DECR_REF(inp); SCTP_INP_DECR_REF(inp);
} }
out_no_decr: out_no_decr:
SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type %d)\n", SCTPDBG(SCTP_DEBUG_TIMER1, "Timer now complete (type = %d)\n", type);
tmr->type);
CURVNET_RESTORE(); CURVNET_RESTORE();
} }