From 251befa78d72c4a99adcb183f912b556c978da4b Mon Sep 17 00:00:00 2001 From: bluhm Date: Wed, 17 Aug 2016 13:53:14 +0000 Subject: [PATCH] Fix an mbuf leak and missing error propagation in uipc_usrreq(PRU_SEND) in case sbappendcontrol() fails. From Simon Mages; OK mikeb@ --- sys/kern/uipc_usrreq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.20.1