summaryrefslogtreecommitdiff
path: root/sys/kern/uipc_socket2.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-02-18 19:11:28 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-02-18 19:11:28 +0000
commit7d3af9195cbf29c00dede3a0f9f0e37b2f9fedb8 (patch)
treed73d51a4f423db7e8de03349da54522970183870 /sys/kern/uipc_socket2.c
parentea53bad61db581907dbda95f73394bf74ffb0ea3 (diff)
Revert previous. It triggers mbuf pool exhaustion on arm64.
Requested by claudio@
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r--sys/kern/uipc_socket2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index d795315c724..d90d9c906ce 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.90 2018/02/10 06:00:06 claudio Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.91 2018/02/18 19:11:27 kettenis Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -464,7 +464,8 @@ sbreserve(struct socket *so, struct sockbuf *sb, u_long cc)
if (cc == 0 || cc > sb_max)
return (1);
sb->sb_hiwat = cc;
- sb->sb_mbmax = max(3 * MAXMCLBYTES, cc * 8);
+ sb->sb_mbmax = max(3 * MAXMCLBYTES,
+ min(cc * 2, sb_max + (sb_max / MCLBYTES) * MSIZE));
if (sb->sb_lowat > sb->sb_hiwat)
sb->sb_lowat = sb->sb_hiwat;
return (0);