diff options
author | 2018-09-20 18:59:10 +0000 | |
---|---|---|
committer | 2018-09-20 18:59:10 +0000 | |
commit | 8a7b43ff23c5924c9f444901961e4773621c2482 (patch) | |
tree | d2ede48d22231569aff2e3cabd5b4ac382c52de8 /sys/netinet/tcp_subr.c | |
parent | missing space after comma (diff) | |
download | wireguard-openbsd-8a7b43ff23c5924c9f444901961e4773621c2482.tar.xz wireguard-openbsd-8a7b43ff23c5924c9f444901961e4773621c2482.zip |
As a step towards per inpcb or socket locks, remove the net lock
for netstat -a. Introduce a global mutex that protects the tables
and hashes for the internet PCBs. To detect detached PCB, set its
inp_socket field to NULL. This has to be protected by a per PCB
mutex. The protocol pointer has to be protected by the mutex as
netstat uses it.
Always take the kernel lock in in_pcbnotifyall() and in6_pcbnotify()
before the table mutex to avoid lock ordering problems in the notify
functions.
OK visa@
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r-- | sys/netinet/tcp_subr.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 99bf6bebc78..15548a154bb 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_subr.c,v 1.172 2018/06/14 01:24:08 yasuoka Exp $ */ +/* $OpenBSD: tcp_subr.c,v 1.173 2018/09/20 18:59:10 bluhm Exp $ */ /* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */ /* @@ -520,7 +520,9 @@ tcp_close(struct tcpcb *tp) /* Free tcpcb after all pending timers have been run. */ TCP_TIMER_ARM(tp, TCPT_REAPER, 0); + mtx_enter(&inp->inp_mtx); inp->inp_ppcb = NULL; + mtx_leave(&inp->inp_mtx); soisdisconnected(so); in_pcbdetach(inp); return (NULL); |