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>
Hi Gang, On 29/05/2026 19:05, Gang Yan wrote: > 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(). Thank you for the v3, that's clearer! Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Now in our tree: New patches for t/upstream-net and t/upstream: - 712f17627662: mptcp: check desc->count in read_sock - Results: 8baa4a3c8611..62fe948e8800 (export-net) - Results: cfc728a98c10..99bd35126f64 (export) Tests are now in progress: - export-net: https://github.com/multipath-tcp/mptcp_net-next/commit/27a7d32aeb103a5c763966a494b141136c31cea0/checks - export: https://github.com/multipath-tcp/mptcp_net-next/commit/b5e39d0f9ca9baae6da2403900a1f57769b6c160/checks Cheers, Matt -- Sponsored by the NGI0 Core fund.
Hi Gang,
Thank you for your modifications, that's great!
Our CI did some validations and here is its report:
- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/26628830138
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/2de62cd3bf50
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1102746
If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normal
For more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
© 2016 - 2026 Red Hat, Inc.