[PATCH mptcp-next v2 1/2] mptcp: check desc->count in read_sock

Geliang Tang posted 2 patches 6 days, 8 hours ago
[PATCH mptcp-next v2 1/2] mptcp: check desc->count in read_sock
Posted by Geliang Tang 6 days, 8 hours ago
From: Gang Yan <yangang@kylinos.cn>

In __tcp_read_sock(), it checks whether desc->count equals 0 within the
loop and breaks the loop if true. This check should also be synchronized
to __mptcp_read_sock().

Co-developed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Gang Yan <yangang@kylinos.cn>
---
 net/mptcp/protocol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index c88882062c40..fd9a574d1dda 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4382,6 +4382,8 @@ static int __mptcp_read_sock(struct sock *sk, read_descriptor_t *desc,
 		}
 
 		mptcp_eat_recv_skb(sk, skb);
+		if (!desc->count)
+			break;
 	}
 
 	if (noack)
-- 
2.52.0