summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2017-07-27 12:04:42 +0000
committermpi <mpi@openbsd.org>2017-07-27 12:04:42 +0000
commit9f2d5ee8b00a485c9df8dcafafb2184fd6d12da2 (patch)
treeae3144aecbbaca93d7fa4d16f48443e244ec2ae9
parentfcntl(F_DUPFD) needs an argument. Otherwise it fails with EINVAL (diff)
downloadwireguard-openbsd-9f2d5ee8b00a485c9df8dcafafb2184fd6d12da2.tar.xz
wireguard-openbsd-9f2d5ee8b00a485c9df8dcafafb2184fd6d12da2.zip
Grab the KERNEL_LOCK() before calling sorwakeup().
In the forwarding path, pf_test() is executed w/o KERNEL_LOCK() and in case of divert end up calling sowakup(). However selwakup() and csignal() are not yet ready to be executed w/o KERNEL_LOCK(). ok bluhm@
-rw-r--r--sys/netinet/ip_divert.c7
-rw-r--r--sys/netinet6/ip6_divert.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index cc93134864a..82b55806b7b 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.48 2017/06/26 09:32:32 mpi Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.49 2017/07/27 12:04:42 mpi Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -226,8 +226,11 @@ divert_packet(struct mbuf *m, int dir, u_int16_t divert_port)
divstat_inc(divs_fullsock);
m_freem(m);
return (0);
- } else
+ } else {
+ KERNEL_LOCK();
sorwakeup(inp->inp_socket);
+ KERNEL_UNLOCK();
+ }
}
if (sa == NULL) {
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index 574201fac18..1afdf9a5096 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.48 2017/06/26 09:32:32 mpi Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.49 2017/07/27 12:04:42 mpi Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -227,8 +227,11 @@ divert6_packet(struct mbuf *m, int dir, u_int16_t divert_port)
div6stat_inc(div6s_fullsock);
m_freem(m);
return (0);
- } else
+ } else {
+ KERNEL_LOCK();
sorwakeup(inp->inp_socket);
+ KERNEL_UNLOCK();
+ }
}
if (sa == NULL) {