summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_ksocket.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-06-12 20:47:32 +0000
committerrwatson <rwatson@FreeBSD.org>2004-06-12 20:47:32 +0000
commit82295697cd4bae93852c3a10a939f20227018fbd (patch)
tree2812a78c30b81fab868b44d389f32cc00ebadc47 /sys/netgraph/ng_ksocket.c
parentf6af690bdeb2e55a1bdabd5af91a8a601955e892 (diff)
downloadFreeBSD-src-82295697cd4bae93852c3a10a939f20227018fbd.zip
FreeBSD-src-82295697cd4bae93852c3a10a939f20227018fbd.tar.gz
Extend coverage of SOCK_LOCK(so) to include so_count, the socket
reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS
Diffstat (limited to 'sys/netgraph/ng_ksocket.c')
-rw-r--r--sys/netgraph/ng_ksocket.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/netgraph/ng_ksocket.c b/sys/netgraph/ng_ksocket.c
index 56d1881..badc69c 100644
--- a/sys/netgraph/ng_ksocket.c
+++ b/sys/netgraph/ng_ksocket.c
@@ -1205,8 +1205,10 @@ ng_ksocket_finish_accept(priv_p priv)
head->so_qlen--;
so->so_qstate &= ~SQ_COMP;
so->so_head = NULL;
+ SOCK_LOCK(so);
soref(so);
so->so_state |= SS_NBIO;
+ SOCK_UNLOCK(so);
ACCEPT_UNLOCK();
/* XXX KNOTE(&head->so_rcv.sb_sel.si_note, 0); */
OpenPOWER on IntegriCloud