1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

tcp_twstart() need to be called with the TCP protocol lock held to avoid

a race condition with the TCP timer routines.
This commit is contained in:
Jeffrey Hsu 2003-02-24 00:52:03 +00:00
parent 93943fff46
commit 11a20fb8b6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111389
2 changed files with 16 additions and 12 deletions

View File

@ -1963,9 +1963,9 @@ tcp_input(m, off0)
case TCPS_CLOSING:
if (ourfinisacked) {
KASSERT(headlocked, ("headlocked"));
tcp_twstart(tp);
INP_INFO_WUNLOCK(&tcbinfo);
m_freem(m);
tcp_twstart(tp);
return;
}
break;
@ -2078,8 +2078,10 @@ tcp_input(m, off0)
}
dodata: /* XXX */
KASSERT(headlocked, ("headlocked"));
INP_INFO_WUNLOCK(&tcbinfo);
headlocked = 0;
if (!(thflags & TH_FIN && tp->t_state == TCPS_FIN_WAIT_2)) {
INP_INFO_WUNLOCK(&tcbinfo);
headlocked = 0;
}
/*
* Process the segment text, merging it into the TCP sequencing queue,
* and arranging for acknowledgment of receipt if necessary.
@ -2183,8 +2185,9 @@ tcp_input(m, off0)
* standard timers.
*/
case TCPS_FIN_WAIT_2:
KASSERT(headlocked == 0, ("headlocked"));
KASSERT(headlocked == 1, ("headlocked should be 1"));
tcp_twstart(tp);
INP_INFO_WUNLOCK(&tcbinfo);
return;
/*
@ -2211,11 +2214,10 @@ tcp_input(m, off0)
check_delack:
if (tp->t_flags & TF_DELACK) {
tp->t_flags &= ~TF_DELACK;
KASSERT(!callout_active(tp->tt_delack),
("delayed ack already active"));
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
}
KASSERT(headlocked == 0, ("headlocked should be 0"));
INP_UNLOCK(inp);
return;

View File

@ -1963,9 +1963,9 @@ tcp_input(m, off0)
case TCPS_CLOSING:
if (ourfinisacked) {
KASSERT(headlocked, ("headlocked"));
tcp_twstart(tp);
INP_INFO_WUNLOCK(&tcbinfo);
m_freem(m);
tcp_twstart(tp);
return;
}
break;
@ -2078,8 +2078,10 @@ tcp_input(m, off0)
}
dodata: /* XXX */
KASSERT(headlocked, ("headlocked"));
INP_INFO_WUNLOCK(&tcbinfo);
headlocked = 0;
if (!(thflags & TH_FIN && tp->t_state == TCPS_FIN_WAIT_2)) {
INP_INFO_WUNLOCK(&tcbinfo);
headlocked = 0;
}
/*
* Process the segment text, merging it into the TCP sequencing queue,
* and arranging for acknowledgment of receipt if necessary.
@ -2183,8 +2185,9 @@ tcp_input(m, off0)
* standard timers.
*/
case TCPS_FIN_WAIT_2:
KASSERT(headlocked == 0, ("headlocked"));
KASSERT(headlocked == 1, ("headlocked should be 1"));
tcp_twstart(tp);
INP_INFO_WUNLOCK(&tcbinfo);
return;
/*
@ -2211,11 +2214,10 @@ tcp_input(m, off0)
check_delack:
if (tp->t_flags & TF_DELACK) {
tp->t_flags &= ~TF_DELACK;
KASSERT(!callout_active(tp->tt_delack),
("delayed ack already active"));
callout_reset(tp->tt_delack, tcp_delacktime,
tcp_timer_delack, tp);
}
KASSERT(headlocked == 0, ("headlocked should be 0"));
INP_UNLOCK(inp);
return;