summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_usrreq.c
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-12-20 18:33:43 +0000
committerbluhm <bluhm@openbsd.org>2016-12-20 18:33:43 +0000
commit4eb8db84bc9d6a660b66b3f79301db47bc24b926 (patch)
tree0ccaf106b2bfb5c91eb9a0858f2bd9eae444e8c1 /sys/netinet/tcp_usrreq.c
parentIn midiread() and midiwrite(), add a second goto label to (diff)
downloadwireguard-openbsd-4eb8db84bc9d6a660b66b3f79301db47bc24b926.tar.xz
wireguard-openbsd-4eb8db84bc9d6a660b66b3f79301db47bc24b926.zip
A NET_LOCK() was is missing in tcp_sysctl() which shows up as spl
softnet assert failures. It is better to place the lock into net_sysctl() where all the protocol sysctls are called via pr_sysctl. As calling sysctl(2) is in the slow path, doing fine grained locking has no benefit. Many sysctl cases copy out a struct. Having a lock around that keeps the struct consistent. Put assertions in the protocol sysctls that need it. OK mpi@
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r--sys/netinet/tcp_usrreq.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index ed781bafdd7..5cd71d38c04 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.138 2016/12/20 14:10:00 mpi Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.139 2016/12/20 18:33:43 bluhm Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -846,6 +846,8 @@ tcp_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
{
int error, nval;
+ NET_ASSERT_LOCKED();
+
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return (ENOTDIR);