Skip to contentSkip to conversation

mptcp: avoid potential infinite loop in mptcp_recvmsg()

PATCH Applied Eric Dumazet 4 participants 4 messages Dec 2, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptcp: avoid potential infinite loop in mptcp_recvmsg()

From: Eric Dumazet <[email protected]>

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")
Cc Paolo Abeni <[email protected]>
---
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mptcp/protocol.c +1 -1
index 221f7cdd416bdb681968bf1b3ff2ed1b03cea3ce..57213ff60f784fae14c2a96f391ccdec6249c168 100644
@@ -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);
Signature · 1 line
2.29.2.454.gaff20da3a2-goog
maintainer Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

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")
Cc Paolo Abeni <[email protected]>

Thanks Eric!

Reviewed-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 6 lines · Eric Dumazet

From: Eric Dumazet <[email protected]>

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().

Quoted 7 lines
Fixes ea4ca586b16f ("mptcp: refine MPTCP-level ack scheduling")
Cc Paolo Abeni <[email protected]>

---
net/mptcp/protocol.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

Thanks for catching this Eric.

--
Mat Martineau
Intel

maintainer Applied
#3 lore raw
In reply to Eric Dumazet
Quoted 9 lines · On Wed, 2 Dec 2020 09:16:57 -0800 Eric Dumazet wrote:

From: Eric Dumazet <[email protected]>

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")
Cc Paolo Abeni <[email protected]>

Applied, thanks!