Fix an mbuf leak and missing error propagation in uipc_usrreq(PRU_SEND)
authorbluhm <bluhm@openbsd.org>
Wed, 17 Aug 2016 13:53:14 +0000 (13:53 +0000)
committerbluhm <bluhm@openbsd.org>
Wed, 17 Aug 2016 13:53:14 +0000 (13:53 +0000)
in case sbappendcontrol() fails.
From Simon Mages; OK mikeb@

sys/kern/uipc_usrreq.c

index 775aedf..6e3d08f 100644 (file)
@@ -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