summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/uipc_usrreq.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 4bad386..3a34f58 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -816,7 +816,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
struct unpcb *unp, *unp2;
struct socket *so2;
u_int mbcnt_delta, sbcc;
- u_long newhiwat;
+ u_int newhiwat;
int error = 0;
unp = sotounpcb(so);
@@ -974,7 +974,10 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
sorwakeup_locked(so2);
SOCKBUF_LOCK(&so->so_snd);
- newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc);
+ if ((int)so->so_snd.sb_hiwat >= (int)(sbcc - unp2->unp_cc))
+ newhiwat = so->so_snd.sb_hiwat - (sbcc - unp2->unp_cc);
+ else
+ newhiwat = 0;
(void)chgsbsize(so->so_cred->cr_uidinfo, &so->so_snd.sb_hiwat,
newhiwat, RLIM_INFINITY);
so->so_snd.sb_mbmax -= mbcnt_delta;
OpenPOWER on IntegriCloud