tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
From: Geliang Tang <tanggeliang@kylinos.cn>
Check the return value of splice().
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index ff1a298d3469..aaa2248ac76e 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -947,14 +947,16 @@ static int do_splice(const int infd, const int outfd, const size_t len,
while ((bytes = splice(infd, NULL, pipefd[1], NULL,
len - winfo->total_len,
SPLICE_F_MOVE | SPLICE_F_MORE)) > 0) {
- splice(pipefd[0], NULL, outfd, NULL, bytes,
- SPLICE_F_MOVE | SPLICE_F_MORE);
+ bytes = splice(pipefd[0], NULL, outfd, NULL, bytes,
+ SPLICE_F_MOVE | SPLICE_F_MORE);
+ if (bytes <= 0)
+ break;
}
close(pipefd[0]);
close(pipefd[1]);
- return 0;
+ return bytes < 0 ? bytes : 0;
}
static int copyfd_io_splice(int infd, int peerfd, int outfd, unsigned int size,
--
2.51.0
Hi Geliang,
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): Unstable: 2 failed test(s): packetdrill_dss packetdrill_fastopen 🔴
- 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/21513386911
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/d48f3ead61fc
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1048930
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)
Hi Geliang,
On 30/01/2026 11:43, Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
>
> Check the return value of splice().
Thank you for looking at that.
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> index ff1a298d3469..aaa2248ac76e 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> @@ -947,14 +947,16 @@ static int do_splice(const int infd, const int outfd, const size_t len,
> while ((bytes = splice(infd, NULL, pipefd[1], NULL,
> len - winfo->total_len,
> SPLICE_F_MOVE | SPLICE_F_MORE)) > 0) {
> - splice(pipefd[0], NULL, outfd, NULL, bytes,
> - SPLICE_F_MOVE | SPLICE_F_MORE);
> + bytes = splice(pipefd[0], NULL, outfd, NULL, bytes,
> + SPLICE_F_MOVE | SPLICE_F_MORE);
> + if (bytes <= 0)
> + break;
Please check [1]: that's not enough: it is important to print the error
to be able to find out what went wrong in case of error. Also, the two
splice() should return the same value, and if "bytes" is 0 here, that's
not normal.
[1]
https://lore.kernel.org/mptcp/20260130-mptcp-sft-no-ignore-splice-err-v1-1-af0a458b6ec8@kernel.org
> }
>
> close(pipefd[0]);
> close(pipefd[1]);
>
> - return 0;
> + return bytes < 0 ? bytes : 0;
The returned value is supposed to be positive (that's the exit returned
value). Also, I don't think you are supposed to have bytes > 0 here, no?
> }
>
> static int copyfd_io_splice(int infd, int peerfd, int outfd, unsigned int size,
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
Hi Matt,
I just noticed that you also submitted a squash-to patch to fix this
issue. Your patch is better, so I've changed the status of this one to
Rejected.
Thanks,
-Geliang
On Fri, 2026-01-30 at 11:50 +0100, Matthieu Baerts wrote:
> Hi Geliang,
>
> On 30/01/2026 11:43, Geliang Tang wrote:
> > From: Geliang Tang <tanggeliang@kylinos.cn>
> >
> > Check the return value of splice().
>
> Thank you for looking at that.
>
> > Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> > ---
> > tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> > b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> > index ff1a298d3469..aaa2248ac76e 100644
> > --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
> > +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
> > @@ -947,14 +947,16 @@ static int do_splice(const int infd, const
> > int outfd, const size_t len,
> > while ((bytes = splice(infd, NULL, pipefd[1], NULL,
> > len - winfo->total_len,
> > SPLICE_F_MOVE | SPLICE_F_MORE)) >
> > 0) {
> > - splice(pipefd[0], NULL, outfd, NULL, bytes,
> > - SPLICE_F_MOVE | SPLICE_F_MORE);
> > + bytes = splice(pipefd[0], NULL, outfd, NULL,
> > bytes,
> > + SPLICE_F_MOVE | SPLICE_F_MORE);
> > + if (bytes <= 0)
> > + break;
>
> Please check [1]: that's not enough: it is important to print the
> error
> to be able to find out what went wrong in case of error. Also, the
> two
> splice() should return the same value, and if "bytes" is 0 here,
> that's
> not normal.
>
> [1]
> https://lore.kernel.org/mptcp/20260130-mptcp-sft-no-ignore-splice-err-v1-1-af0a458b6ec8@kernel.org
>
> > }
> >
> > close(pipefd[0]);
> > close(pipefd[1]);
> >
> > - return 0;
> > + return bytes < 0 ? bytes : 0;
>
> The returned value is supposed to be positive (that's the exit
> returned
> value). Also, I don't think you are supposed to have bytes > 0 here,
> no?
>
> > }
> >
> > static int copyfd_io_splice(int infd, int peerfd, int outfd,
> > unsigned int size,
>
> Cheers,
> Matt
© 2016 - 2026 Red Hat, Inc.