summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-08-17 13:53:14 +0000
committerbluhm <bluhm@openbsd.org>2016-08-17 13:53:14 +0000
commit251befa78d72c4a99adcb183f912b556c978da4b (patch)
treeec74c96c03301b131d1134340576fd9e7f1b8207 /sys
parentNothing from the original Wasabi code remains, so replace the copyright (diff)
downloadwireguard-openbsd-251befa78d72c4a99adcb183f912b556c978da4b.tar.xz
wireguard-openbsd-251befa78d72c4a99adcb183f912b556c978da4b.zip
Fix an mbuf leak and missing error propagation in uipc_usrreq(PRU_SEND)
in case sbappendcontrol() fails. From Simon Mages; OK mikeb@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_usrreq.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 775aedf432e..6e3d08fe398 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.100 2016/07/19 05:30:48 tedu Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.101 2016/08/17 13:53:14 bluhm Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -254,6 +254,10 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
if (control) {
if (sbappendcontrol(rcv, m, control))
control = NULL;
+ else {
+ error = ENOBUFS;
+ break;
+ }
} else if (so->so_type == SOCK_SEQPACKET)
sbappendrecord(rcv, m);
else