* [PATCH net-next 0/3] mptcp: misc minor cleanups
@ 2025-09-12 16:36 Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 1/3] selftests: mptcp: close server file descriptors Matthieu Baerts (NGI0)
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-09-12 16:36 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
Cc: netdev, mptcp, linux-kselftest, linux-kernel,
Matthieu Baerts (NGI0), Donald Hunter, Geliang Tang
Here are some small unrelated cleanups collected when working on some
fixes recently.
- Patches 1 & 2: close file descriptors in exit paths in the selftests.
- Patch 3: fix a wrong type (int i/o u32) when parsing netlink message.
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
Geliang Tang (2):
selftests: mptcp: close server file descriptors
selftests: mptcp: close server IPC descriptors
Matthieu Baerts (NGI0) (1):
mptcp: pm: netlink: fix if-idx type
net/mptcp/pm_netlink.c | 2 +-
tools/testing/selftests/net/mptcp/mptcp_inq.c | 9 +++++++--
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 9 +++++++--
3 files changed, 15 insertions(+), 5 deletions(-)
---
base-commit: dc2f650f7e6857bf384069c1a56b2937a1ee370d
change-id: 20250912-net-next-mptcp-minor-fixes-6-18-a10e141ae3e7
Best regards,
--
Matthieu Baerts (NGI0) <matttbe@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/3] selftests: mptcp: close server file descriptors
2025-09-12 16:36 [PATCH net-next 0/3] mptcp: misc minor cleanups Matthieu Baerts (NGI0)
@ 2025-09-12 16:36 ` Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 2/3] selftests: mptcp: close server IPC descriptors Matthieu Baerts (NGI0)
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-09-12 16:36 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
Cc: netdev, mptcp, linux-kselftest, linux-kernel,
Matthieu Baerts (NGI0), Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
The server file descriptor ('fd') is opened in server() but never closed.
While accepted connections are properly closed in process_one_client(),
the main listening socket remains open, causing a resource leak.
This patch ensures the server fd is properly closed after processing
clients, bringing the sockopt and inq test cases in line with proper
resource cleanup practices.
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
tools/testing/selftests/net/mptcp/mptcp_inq.c | 1 +
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_inq.c b/tools/testing/selftests/net/mptcp/mptcp_inq.c
index f3bcaa48df8f22e8f4833fcc3b919d21764bf7fb..40f2a1b24763e3b84e12bfae7b893c35e6c2af71 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_inq.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_inq.c
@@ -502,6 +502,7 @@ static int server(int unixfd)
process_one_client(r, unixfd);
+ close(fd);
return 0;
}
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index e934dd26a59d9b50445d61e8b8013ce3c8d2a8a0..b44b6c9b05507780fa85221e61813182cf7c082e 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -722,6 +722,7 @@ static int server(int pipefd)
process_one_client(r, pipefd);
+ close(fd);
return 0;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 2/3] selftests: mptcp: close server IPC descriptors
2025-09-12 16:36 [PATCH net-next 0/3] mptcp: misc minor cleanups Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 1/3] selftests: mptcp: close server file descriptors Matthieu Baerts (NGI0)
@ 2025-09-12 16:36 ` Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 3/3] mptcp: pm: netlink: fix if-idx type Matthieu Baerts (NGI0)
2025-09-16 1:30 ` [PATCH net-next 0/3] mptcp: misc minor cleanups patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-09-12 16:36 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
Cc: netdev, mptcp, linux-kselftest, linux-kernel,
Matthieu Baerts (NGI0), Geliang Tang
From: Geliang Tang <tanggeliang@kylinos.cn>
The client-side function connect_one_server() properly closes its IPC
descriptor after use, but the server-side code in both mptcp_sockopt.c
and mptcp_inq.c was missing corresponding close() calls for their IPC
descriptors, leaving file descriptors open unnecessarily.
This change ensures proper cleanup by:
1. Adding missing close(pipefds[0]/unixfds[0]) in server processes
2. Adding close(pipefds[1]/unixfds[1]) after server() function calls
This ensures both ends of the IPC pipe are properly closed in their
respective processes, preventing file descriptor leaks.
Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
tools/testing/selftests/net/mptcp/mptcp_inq.c | 8 ++++++--
tools/testing/selftests/net/mptcp/mptcp_sockopt.c | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_inq.c b/tools/testing/selftests/net/mptcp/mptcp_inq.c
index 40f2a1b24763e3b84e12bfae7b893c35e6c2af71..8e8f6441ad8b0a79216eaf8f3b34c4ed2c2a1736 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_inq.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_inq.c
@@ -581,8 +581,12 @@ int main(int argc, char *argv[])
die_perror("pipe");
s = xfork();
- if (s == 0)
- return server(unixfds[1]);
+ if (s == 0) {
+ close(unixfds[0]);
+ ret = server(unixfds[1]);
+ close(unixfds[1]);
+ return ret;
+ }
close(unixfds[1]);
diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
index b44b6c9b05507780fa85221e61813182cf7c082e..e9c359df941604b9d5eec17bb83d57afe1aa34fb 100644
--- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
+++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
@@ -848,8 +848,12 @@ int main(int argc, char *argv[])
die_perror("pipe");
s = xfork();
- if (s == 0)
- return server(pipefds[1]);
+ if (s == 0) {
+ close(pipefds[0]);
+ ret = server(pipefds[1]);
+ close(pipefds[1]);
+ return ret;
+ }
close(pipefds[1]);
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net-next 3/3] mptcp: pm: netlink: fix if-idx type
2025-09-12 16:36 [PATCH net-next 0/3] mptcp: misc minor cleanups Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 1/3] selftests: mptcp: close server file descriptors Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 2/3] selftests: mptcp: close server IPC descriptors Matthieu Baerts (NGI0)
@ 2025-09-12 16:36 ` Matthieu Baerts (NGI0)
2025-09-16 1:30 ` [PATCH net-next 0/3] mptcp: misc minor cleanups patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts (NGI0) @ 2025-09-12 16:36 UTC (permalink / raw)
To: Mat Martineau, Geliang Tang, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Shuah Khan
Cc: netdev, mptcp, linux-kselftest, linux-kernel,
Matthieu Baerts (NGI0), Donald Hunter
As pointed out by Donald, when parsing an entry, the wrong type was set
for the temp value: this value is signed.
There are no real issues here, because the intermediate variable was
only wrong for the sign, not for the size, and the final variable had
the right sign. But this feels wrong, and is confusing, so fixing this
small typo introduced by commit ef0da3b8a2f1 ("mptcp: move address
attribute into mptcp_addr_info").
Reported-by: Donald Hunter <donald.hunter@gmail.com>
Closes: https://lore.kernel.org/m2plc0ui9z.fsf@gmail.com
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
net/mptcp/pm_netlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c
index 50aaf259959aeaf36e7ab954c6f7957eaf2bc390..2225b1c5b96666cd4121854c967a7f3a79824047 100644
--- a/net/mptcp/pm_netlink.c
+++ b/net/mptcp/pm_netlink.c
@@ -113,7 +113,7 @@ int mptcp_pm_parse_entry(struct nlattr *attr, struct genl_info *info,
return err;
if (tb[MPTCP_PM_ADDR_ATTR_IF_IDX]) {
- u32 val = nla_get_s32(tb[MPTCP_PM_ADDR_ATTR_IF_IDX]);
+ s32 val = nla_get_s32(tb[MPTCP_PM_ADDR_ATTR_IF_IDX]);
entry->ifindex = val;
}
--
2.51.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 0/3] mptcp: misc minor cleanups
2025-09-12 16:36 [PATCH net-next 0/3] mptcp: misc minor cleanups Matthieu Baerts (NGI0)
` (2 preceding siblings ...)
2025-09-12 16:36 ` [PATCH net-next 3/3] mptcp: pm: netlink: fix if-idx type Matthieu Baerts (NGI0)
@ 2025-09-16 1:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-16 1:30 UTC (permalink / raw)
To: Matthieu Baerts
Cc: martineau, geliang, davem, edumazet, kuba, pabeni, horms, shuah,
netdev, mptcp, linux-kselftest, linux-kernel, donald.hunter
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 12 Sep 2025 18:36:46 +0200 you wrote:
> Here are some small unrelated cleanups collected when working on some
> fixes recently.
>
> - Patches 1 & 2: close file descriptors in exit paths in the selftests.
>
> - Patch 3: fix a wrong type (int i/o u32) when parsing netlink message.
>
> [...]
Here is the summary with links:
- [net-next,1/3] selftests: mptcp: close server file descriptors
https://git.kernel.org/netdev/net-next/c/dab86ee688ae
- [net-next,2/3] selftests: mptcp: close server IPC descriptors
https://git.kernel.org/netdev/net-next/c/e3241506a471
- [net-next,3/3] mptcp: pm: netlink: fix if-idx type
https://git.kernel.org/netdev/net-next/c/3f9a22be374b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-16 1:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12 16:36 [PATCH net-next 0/3] mptcp: misc minor cleanups Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 1/3] selftests: mptcp: close server file descriptors Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 2/3] selftests: mptcp: close server IPC descriptors Matthieu Baerts (NGI0)
2025-09-12 16:36 ` [PATCH net-next 3/3] mptcp: pm: netlink: fix if-idx type Matthieu Baerts (NGI0)
2025-09-16 1:30 ` [PATCH net-next 0/3] mptcp: misc minor cleanups patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).