[PATCH mptcp-next v3] selftests: mptcp: fix incorrect fd checks in main_loop

Geliang Tang posted 1 patch 2 weeks, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/59caf78b9d67a0a61a19a46f7820456f6ced3d6e.1742296236.git.tanggeliang@kylinos.cn
tools/testing/selftests/net/mptcp/mptcp_connect.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH mptcp-next v3] selftests: mptcp: fix incorrect fd checks in main_loop
Posted by Geliang Tang 2 weeks, 6 days ago
From: Cong Liu <liucong2@kylinos.cn>

Fix a bug where the code was checking the wrong file descriptors
when opening the input files. The code was checking 'fd' instead
of 'fd_in', which could lead to incorrect error handling.

Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
Fixes: ca7ae8916043 ("selftests: mptcp: mptfo Initiator/Listener")
Co-developed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
---

v3:
 - resend the pending patch from Cong Liu, he said to me that he has
   no time to deal with this recently.
 - add another "Fixes" tag as Matt suggested.
 - update the subject and commit log.

v2:
 - https://patchwork.kernel.org/project/mptcp/patch/20250116085459.31419-1-liucong2@kylinos.cn/
---
 tools/testing/selftests/net/mptcp/mptcp_connect.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c
index d240d02fa443..893dc36b12f6 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c
@@ -1270,7 +1270,7 @@ int main_loop(void)
 
 	if (cfg_input && cfg_sockopt_types.mptfo) {
 		fd_in = open(cfg_input, O_RDONLY);
-		if (fd < 0)
+		if (fd_in < 0)
 			xerror("can't open %s:%d", cfg_input, errno);
 	}
 
@@ -1293,7 +1293,7 @@ int main_loop(void)
 
 	if (cfg_input && !cfg_sockopt_types.mptfo) {
 		fd_in = open(cfg_input, O_RDONLY);
-		if (fd < 0)
+		if (fd_in < 0)
 			xerror("can't open %s:%d", cfg_input, errno);
 	}
 
-- 
2.43.0
Re: [PATCH mptcp-next v3] selftests: mptcp: fix incorrect fd checks in main_loop
Posted by Matthieu Baerts 2 weeks, 5 days ago
Hi Geliang, Cong,

On 18/03/2025 12:15, Geliang Tang wrote:
> From: Cong Liu <liucong2@kylinos.cn>
> 
> Fix a bug where the code was checking the wrong file descriptors
> when opening the input files. The code was checking 'fd' instead
> of 'fd_in', which could lead to incorrect error handling.
> 
> Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
> Fixes: ca7ae8916043 ("selftests: mptcp: mptfo Initiator/Listener")
> Co-developed-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Geliang Tang <geliang@kernel.org>
> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
> ---
> 
> v3:
>  - resend the pending patch from Cong Liu, he said to me that he has
>    no time to deal with this recently.
>  - add another "Fixes" tag as Matt suggested.
>  - update the subject and commit log.

Thank you for the v3!

It looks good to me:

Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>

Small detail: that's for mptcp-net, not next.

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.
Re: [PATCH mptcp-next v3] selftests: mptcp: fix incorrect fd checks in main_loop
Posted by Matthieu Baerts 2 weeks, 5 days ago
On 19/03/2025 18:35, Matthieu Baerts wrote:
> Hi Geliang, Cong,
> 
> On 18/03/2025 12:15, Geliang Tang wrote:
>> From: Cong Liu <liucong2@kylinos.cn>
>>
>> Fix a bug where the code was checking the wrong file descriptors
>> when opening the input files. The code was checking 'fd' instead
>> of 'fd_in', which could lead to incorrect error handling.
>>
>> Fixes: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
>> Fixes: ca7ae8916043 ("selftests: mptcp: mptfo Initiator/Listener")
>> Co-developed-by: Geliang Tang <geliang@kernel.org>
>> Signed-off-by: Geliang Tang <geliang@kernel.org>
>> Signed-off-by: Cong Liu <liucong2@kylinos.cn>
>> ---
>>
>> v3:
>>  - resend the pending patch from Cong Liu, he said to me that he has
>>    no time to deal with this recently.
>>  - add another "Fixes" tag as Matt suggested.
>>  - update the subject and commit log.
> 
> Thank you for the v3!

Now in our tree:

New patches for t/upstream-net and t/upstream:
- f1aedae2b9e9: selftests: mptcp: fix incorrect fd checks in main_loop
- Results: 337db8693fa1..15fd746f34c5 (export-net)
- Results: 8131e8aff41d..2bea3081157b (export)

Tests are now in progress:

- export-net:
https://github.com/multipath-tcp/mptcp_net-next/commit/9faaf0099006d44557034273d9204d64385cfb1a/checks
- export:
https://github.com/multipath-tcp/mptcp_net-next/commit/b1252371e4122d56004e65cece710905a3de6334/checks

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.