Skip to content

Commit 0a541ea

Browse files
committed
Merge branch 'mptcp-misc-fixes-for-6-15-rc0'
Matthieu Baerts says: ==================== mptcp: misc. fixes for 6.15-rc0 Here are 4 unrelated patches: - Patch 1: fix a NULL pointer when two SYN-ACK for the same request are handled in parallel. A fix for up to v5.9. - Patch 2: selftests: fix check for the wrong FD. A fix for up to v5.17. - Patch 3: selftests: close all FDs in case of error. A fix for up to v5.17. - Patch 4: selftests: ignore a new generated file. A fix for 6.15-rc0. ==================== Link: https://patch.msgid.link/20250328-net-mptcp-misc-fixes-6-15-v1-0-34161a482a7f@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents 323d6db + b44a4c2 commit 0a541ea

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

net/mptcp/subflow.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -754,8 +754,6 @@ static bool subflow_hmac_valid(const struct request_sock *req,
754754

755755
subflow_req = mptcp_subflow_rsk(req);
756756
msk = subflow_req->msk;
757-
if (!msk)
758-
return false;
759757

760758
subflow_generate_hmac(READ_ONCE(msk->remote_key),
761759
READ_ONCE(msk->local_key),
@@ -850,12 +848,8 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
850848

851849
} else if (subflow_req->mp_join) {
852850
mptcp_get_options(skb, &mp_opt);
853-
if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) ||
854-
!subflow_hmac_valid(req, &mp_opt) ||
855-
!mptcp_can_accept_new_subflow(subflow_req->msk)) {
856-
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
851+
if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK))
857852
fallback = true;
858-
}
859853
}
860854

861855
create_child:
@@ -905,6 +899,13 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
905899
goto dispose_child;
906900
}
907901

902+
if (!subflow_hmac_valid(req, &mp_opt) ||
903+
!mptcp_can_accept_new_subflow(subflow_req->msk)) {
904+
SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
905+
subflow_add_reset_reason(skb, MPTCP_RST_EPROHIBIT);
906+
goto dispose_child;
907+
}
908+
908909
/* move the msk reference ownership to the subflow */
909910
subflow_req->msk = NULL;
910911
ctx->conn = (struct sock *)owner;

tools/testing/selftests/net/mptcp/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
mptcp_connect
3+
mptcp_diag
34
mptcp_inq
45
mptcp_sockopt
56
pm_nl_ctl

tools/testing/selftests/net/mptcp/mptcp_connect.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ int main_loop(void)
12701270

12711271
if (cfg_input && cfg_sockopt_types.mptfo) {
12721272
fd_in = open(cfg_input, O_RDONLY);
1273-
if (fd < 0)
1273+
if (fd_in < 0)
12741274
xerror("can't open %s:%d", cfg_input, errno);
12751275
}
12761276

@@ -1293,13 +1293,13 @@ int main_loop(void)
12931293

12941294
if (cfg_input && !cfg_sockopt_types.mptfo) {
12951295
fd_in = open(cfg_input, O_RDONLY);
1296-
if (fd < 0)
1296+
if (fd_in < 0)
12971297
xerror("can't open %s:%d", cfg_input, errno);
12981298
}
12991299

13001300
ret = copyfd_io(fd_in, fd, 1, 0, &winfo);
13011301
if (ret)
1302-
return ret;
1302+
goto out;
13031303

13041304
if (cfg_truncate > 0) {
13051305
shutdown(fd, SHUT_WR);
@@ -1320,7 +1320,10 @@ int main_loop(void)
13201320
close(fd);
13211321
}
13221322

1323-
return 0;
1323+
out:
1324+
if (cfg_input)
1325+
close(fd_in);
1326+
return ret;
13241327
}
13251328

13261329
int parse_proto(const char *proto)

0 commit comments

Comments
 (0)