summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/kern/uipc_usrreq.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-08-09 13:04:41 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-21 10:29:37 +0200
commite4a8065910cd6b2e7e0448cc6431ca2906322389 (patch)
tree73492991cfa40f994c20d761d476e6bc16304536 /freebsd/sys/kern/uipc_usrreq.c
parentUpdate to FreeBSD head 2017-08-01 (diff)
downloadrtems-libbsd-e4a8065910cd6b2e7e0448cc6431ca2906322389.tar.bz2
Update to FreeBSD head 2017-10-01
Git mirror commit b2f0376b45428f13151d229c5ae9d4d8f74acbd1. Update #3472.
Diffstat (limited to 'freebsd/sys/kern/uipc_usrreq.c')
-rw-r--r--freebsd/sys/kern/uipc_usrreq.c17
1 files changed, 13 insertions, 4 deletions
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;