summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_syscalls.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-11-03 12:52:35 +0000
committerkib <kib@FreeBSD.org>2009-11-03 12:52:35 +0000
commitbd5fd681f2fbbc4a77b04b7586fcd7537c516ded (patch)
treeee76646c3a118f1362e1bc2ca4868cfe62fd183a /sys/kern/uipc_syscalls.c
parent6261a13037546b08ff74a0eeb6491b17ce646cc6 (diff)
downloadFreeBSD-src-bd5fd681f2fbbc4a77b04b7586fcd7537c516ded.zip
FreeBSD-src-bd5fd681f2fbbc4a77b04b7586fcd7537c516ded.tar.gz
If socket buffer space appears to be lower then sum of count of already
prepared bytes and next portion of transfer, inner loop of kern_sendfile() aborts, not preparing next mbuf for socket buffer, and not modifying any outer loop invariants. The thread loops in the outer loop forever. Instead of breaking from inner loop, prepare only bytes that fit into the socket buffer space. In collaboration with: pho Reviewed by: bz PR: kern/138999 MFC after: 2 weeks
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r--sys/kern/uipc_syscalls.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 708cefc..c00fd2d 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -2037,20 +2037,12 @@ retry_space:
rem = obj->un_pager.vnp.vnp_size -
uap->offset - fsbytes - loopbytes;
xfsize = omin(rem, xfsize);
+ xfsize = omin(space - loopbytes, xfsize);
if (xfsize <= 0) {
VM_OBJECT_UNLOCK(obj);
done = 1; /* all data sent */
break;
}
- /*
- * Don't overflow the send buffer.
- * Stop here and send out what we've
- * already got.
- */
- if (space < loopbytes + xfsize) {
- VM_OBJECT_UNLOCK(obj);
- break;
- }
/*
* Attempt to look up the page. Allocate
OpenPOWER on IntegriCloud