MPTCP Linux Development
 help / color / mirror / Atom feed
* [PATCH mptcp-net v3] mptcp: check desc->count in read_sock
@ 2026-05-29  9:05 Gang Yan
  2026-05-29 10:25 ` MPTCP CI
  2026-05-31  6:31 ` Matthieu Baerts
  0 siblings, 2 replies; 3+ messages in thread
From: Gang Yan @ 2026-05-29  9:05 UTC (permalink / raw)
  To: MPTCP Linux; +Cc: Gang Yan, Geliang Tang

From: Gang Yan <yangang@kylinos.cn>

__tcp_read_sock() checks desc->count after each skb is consumed and
breaks the loop when it reaches 0. The MPTCP variant lacks this check.

This is a functional bug, other subsystems also rely on this check:
TLS strparser sets desc->count to 0 once a full TLS record is assembled
and depends on this break to stop reading.

Add the same desc->count check to __mptcp_read_sock(), mirroring
__tcp_read_sock().

Fixes: 250d9766a984 ("mptcp: implement .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>
---
Hi Matt,

Apologies for the delay. I only just realized I’ve been overlooking
this thread all this time.

I’ve sent the new patch with commit message uploaded.

Thanks
Gang
---
Changelog:
v3:
  - only update the commit message, no function change.
v2:
 - Link: https://patchwork.kernel.org/project/mptcp/patch/b404cbca4b0d30f82c56f65b38e1c2038bd7e5fe.1773740635.git.tanggeliang@kylinos.cn/

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 29cb10c02ed8..1d652ded9467 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -4476,6 +4476,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)

---
base-commit: 64a0f10e355310447acda9767d4fde746159172f
change-id: 20260529-read_sock_fix-3faa59b82538

Best regards,
-- 
Gang Yan <yangang@kylinos.cn>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-31  6:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29  9:05 [PATCH mptcp-net v3] mptcp: check desc->count in read_sock Gang Yan
2026-05-29 10:25 ` MPTCP CI
2026-05-31  6:31 ` Matthieu Baerts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox