summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2019-05-24 15:17:30 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2019-05-24 15:17:30 +0000
commitb990887ef6bf3e4d74b55db04309b63a63ee2956 (patch)
treed138f80038612745936c381de5890eb1253bab69 /sys/kern
parent7edb57900445177b320ba3f2999e1e2549e224f2 (diff)
Prevent a kernel hang if an empty message is sent over an SOCK_SEQPACKET
socketpair. Do not wakeup receiver if there is no data available. OK claudio@ anton@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_usrreq.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 6444de09019..09fd1bbf77b 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.139 2019/02/13 11:55:21 martijn Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.140 2019/05/24 15:17:29 bluhm Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -267,7 +267,8 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
sbappend(so2, &so2->so_rcv, m);
so->so_snd.sb_mbcnt = so2->so_rcv.sb_mbcnt;
so->so_snd.sb_cc = so2->so_rcv.sb_cc;
- sorwakeup(so2);
+ if (so2->so_rcv.sb_cc > 0)
+ sorwakeup(so2);
m = NULL;
break;