summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-07-14 15:42:24 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-07-14 15:42:24 +0000
commit722d60a49b68f54fe7598fddf4bedd05a2474c19 (patch)
tree1cd57fd7339f3c207fabf46685f1437ffa12b6fb /sys/kern
parent0ad0151e17fa68b36f7b66b16f26b3c89e2bd1f6 (diff)
Fix source and drain confusion in socket splicing somove().
If a large mbuf in the source socket buffer does not fit into the drain buffer, split the mbuf. But if the drain buffer still has some data in it, stop moving data and try again later. This skips a potentially expensive mbuf operation. When looking which socket buffer has to be locked, I found that the length of the source send buffer was checked. Change it to drain. As this is a performance optimization for a special corner case, noone noticed the bug. OK sashan@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index a2dfc010589..a17ac58eaba 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.337 2024/07/12 17:20:18 mvs Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.338 2024/07/14 15:42:23 bluhm Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1690,7 +1690,7 @@ somove(struct socket *so, int wait)
* Move only a partial mbuf at maximum splice length or
* if the drain buffer is too small for this large mbuf.
*/
- if (!maxreached && so->so_snd.sb_datacc > 0) {
+ if (!maxreached && sosp->so_snd.sb_datacc > 0) {
len -= size;
break;
}