From e4a8065910cd6b2e7e0448cc6431ca2906322389 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 9 Aug 2018 13:04:41 +0200 Subject: Update to FreeBSD head 2017-10-01 Git mirror commit b2f0376b45428f13151d229c5ae9d4d8f74acbd1. Update #3472. --- freebsd/sys/kern/uipc_usrreq.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'freebsd/sys/kern/uipc_usrreq.c') diff --git a/freebsd/sys/kern/uipc_usrreq.c b/freebsd/sys/kern/uipc_usrreq.c index 7237956a..702ba1e4 100644 --- a/freebsd/sys/kern/uipc_usrreq.c +++ b/freebsd/sys/kern/uipc_usrreq.c @@ -698,9 +698,9 @@ uipc_close(struct socket *so) { struct unpcb *unp, *unp2; #ifndef __rtems__ - struct vnode *vp; + struct vnode *vp = NULL; #else /* __rtems__ */ - IMFS_generic_t *vp; + IMFS_generic_t *vp = NULL; #endif /* __rtems__ */ unp = sotounpcb(so); @@ -1181,7 +1181,11 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, release: if (control != NULL) m_freem(control); - if (m != NULL) + /* + * In case of PRUS_NOTREADY, uipc_ready() is responsible + * for freeing memory. + */ + if (m != NULL && (flags & PRUS_NOTREADY) == 0) m_freem(m); return (error); } @@ -1196,7 +1200,12 @@ uipc_ready(struct socket *so, struct mbuf *m, int count) unp = sotounpcb(so); UNP_LINK_RLOCK(); - unp2 = unp->unp_conn; + if ((unp2 = unp->unp_conn) == NULL) { + UNP_LINK_RUNLOCK(); + for (int i = 0; i < count; i++) + m = m_free(m); + return (ECONNRESET); + } UNP_PCB_LOCK(unp2); so2 = unp2->unp_socket; -- cgit v1.2.3