aboutsummaryrefslogtreecommitdiffstats
path: root/net/mptcp/protocol.c
diff options
context:
space:
mode:
authorEric Dumazet <[email protected]>2020-12-02 17:16:57 +0000
committerJakub Kicinski <[email protected]>2020-12-02 20:06:12 +0000
commit05e3ecea4a6305597a060da0a123c80df8827bf1 (patch)
treebb16d7fc1d753e559a270b1bded02ff2812af15c /net/mptcp/protocol.c
parentocteontx2-af: debugfs: delete dead code (diff)
downloadkernel-05e3ecea4a6305597a060da0a123c80df8827bf1.tar.gz
kernel-05e3ecea4a6305597a060da0a123c80df8827bf1.zip
mptcp: avoid potential infinite loop in mptcp_recvmsg()
If a packet is ready in receive queue, and application isssues a recvmsg()/recvfrom()/recvmmsg() request asking for zero bytes, we hang in mptcp_recvmsg(). Fixes: ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling") Signed-off-by: Eric Dumazet <[email protected]> Tested-by: Paolo Abeni <[email protected]> Reviewed-by: Mat Martineau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/mptcp/protocol.c')
-rw-r--r--net/mptcp/protocol.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 221f7cdd416b..57213ff60f78 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1921,7 +1921,7 @@ static int mptcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
len = min_t(size_t, len, INT_MAX);
target = sock_rcvlowat(sk, flags & MSG_WAITALL, len);
- for (;;) {
+ while (copied < len) {
int bytes_read, old_space;
bytes_read = __mptcp_recvmsg_mskq(msk, msg, len - copied);