diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-11-23 17:21:30 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-11-23 17:21:30 +0000 |
commit | 75d5a09a05cfc84f37a727d8c1598a9337b21c70 (patch) | |
tree | 3ce39c4cb642096bc4f16bb881a2f0e32e4e0a8e /sys/netinet/tcp_subr.c | |
parent | 53e97a895b3965eb3ce51576bbbc5b9c4f91d736 (diff) | |
download | FreeBSD-src-75d5a09a05cfc84f37a727d8c1598a9337b21c70.zip FreeBSD-src-75d5a09a05cfc84f37a727d8c1598a9337b21c70.tar.gz |
tcp_timewait() performs multiple non-atomic reads on the tcptw
structure, so assert the inpcb lock associated with the tcptw.
Also assert the tcbinfo lock, as tcp_timewait() may call
tcp_twclose() or tcp_2msl_rest(), which require it. Since
tcp_timewait() is already called with that lock from tcp_input(),
this doesn't change current locking, merely documents reasons for
it.
In tcp_twstart(), assert the tcbinfo lock, as tcp_timer_2msl_rest()
is called, which requires that lock.
In tcp_twclose(), assert the tcbinfo lock, as tcp_timer_2msl_stop()
is called, which requires that lock.
Document the locking strategy for the time wait queues in tcp_timer.c,
which consists of protecting the time wait queues in the same manner
as the tcbinfo structure (using the tcbinfo lock).
In tcp_timer_2msl_reset(), assert the tcbinfo lock, as the time wait
queues are modified.
In tcp_timer_2msl_stop(), assert the tcbinfo lock, as the time wait
queues may be modified.
In tcp_timer_2msl_tw(), assert the tcbinfo lock, as the time wait
queues may be modified.
MFC after: 2 weeks
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 8064f2b..32044e4 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1624,6 +1624,7 @@ tcp_twstart(tp) int tw_time, acknow; struct socket *so; + INP_INFO_WLOCK_ASSERT(&tcbinfo); /* tcp_timer_2msl_reset(). */ INP_LOCK_ASSERT(tp->t_inpcb); tw = uma_zalloc(tcptw_zone, M_NOWAIT); @@ -1722,6 +1723,7 @@ tcp_twclose(struct tcptw *tw, int reuse) struct inpcb *inp; inp = tw->tw_inpcb; + INP_INFO_WLOCK_ASSERT(&tcbinfo); /* tcp_timer_2msl_stop(). */ INP_LOCK_ASSERT(inp); tw->tw_inpcb = NULL; |