diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-07-27 12:04:43 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2017-07-27 12:04:43 +0000 |
commit | 2acc818149553e810e21e8fd9fed641297ca52a8 (patch) | |
tree | fa247cd631f3355cc14217c394bdd5b340416952 | |
parent | 35ad6375cdaf55db054683da214d8bbcea149b72 (diff) |
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) { |