Commit e3241506 authored by Geliang Tang's avatar Geliang Tang Committed by Jakub Kicinski
Browse files

selftests: mptcp: close server IPC descriptors



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: default avatarGeliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20250912-net-next-mptcp-minor-fixes-6-18-v1-2-99d179b483ad@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent dab86ee6
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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]);

+6 −2
Original line number Diff line number Diff line
@@ -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]);