diff options
author | 2017-07-27 12:04:42 +0000 | |
---|---|---|
committer | 2017-07-27 12:04:42 +0000 | |
commit | 9f2d5ee8b00a485c9df8dcafafb2184fd6d12da2 (patch) | |
tree | ae3144aecbbaca93d7fa4d16f48443e244ec2ae9 | |
parent | fcntl(F_DUPFD) needs an argument. Otherwise it fails with EINVAL (diff) | |
download | wireguard-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.c | 7 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.c | 7 |
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) { |