summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorniklas <niklas@openbsd.org>1999-05-21 23:15:22 +0000
committerniklas <niklas@openbsd.org>1999-05-21 23:15:22 +0000
commit46a4de3f220cfc33bff8359108dacef4437d69cf (patch)
treee4563aef9a9ebffefe4eccc137ddab12819b309a
parenttypo (diff)
downloadwireguard-openbsd-46a4de3f220cfc33bff8359108dacef4437d69cf.tar.xz
wireguard-openbsd-46a4de3f220cfc33bff8359108dacef4437d69cf.zip
For hard expiration-pressure you need to protect PF_KEY socket
queueing with spltdb()
-rw-r--r--sys/net/pfkey.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/net/pfkey.c b/sys/net/pfkey.c
index 42be9bd022b..46a0a4f33fa 100644
--- a/sys/net/pfkey.c
+++ b/sys/net/pfkey.c
@@ -97,6 +97,7 @@ int
pfkey_sendup(struct socket *socket, struct mbuf *packet, int more)
{
struct mbuf *packet2;
+ int s;
if (more) {
if (!(packet2 = m_copym(packet, 0, M_COPYALL, M_DONTWAIT)))
@@ -104,10 +105,13 @@ pfkey_sendup(struct socket *socket, struct mbuf *packet, int more)
} else
packet2 = packet;
+ s = spltdb();
if (!sbappendaddr(&socket->so_rcv, &pfkey_addr, packet2, NULL)) {
m_freem(packet2);
- return 0;
+ splx(s);
+ return ENOBUFS;
}
+ splx(s);
sorwakeup(socket);
return 0;