Skip to content

Commit 89e2327

Browse files
edumazetkuba-moo
authored andcommitted
mptcp: mptcp_parse_option() fix for MPTCPOPT_MP_JOIN
mptcp_parse_option() currently sets OPTIONS_MPTCP_MPJ, for the three possible cases handled for MPTCPOPT_MP_JOIN option. OPTIONS_MPTCP_MPJ is the combination of three flags: - OPTION_MPTCP_MPJ_SYN - OPTION_MPTCP_MPJ_SYNACK - OPTION_MPTCP_MPJ_ACK This is a problem, because backup, join_id, token, nonce and/or hmac fields could be left uninitialized in some cases. Distinguish the three cases, as following patches will need this step. Fixes: f296234 ("mptcp: Add handling of incoming MP_JOIN requests") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Florian Westphal <fw@strlen.de> Cc: Peter Krystad <peter.krystad@linux.intel.com> Cc: Matthieu Baerts <matttbe@kernel.org> Cc: Mat Martineau <martineau@kernel.org> Cc: Geliang Tang <geliang.tang@linux.dev> Reviewed-by: Simon Horman <horms@kernel.org> Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Mat Martineau <martineau@kernel.org> Link: https://lore.kernel.org/r/20240111194917.4044654-2-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent cbdd50e commit 89e2327

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

net/mptcp/options.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ static void mptcp_parse_option(const struct sk_buff *skb,
123123
break;
124124

125125
case MPTCPOPT_MP_JOIN:
126-
mp_opt->suboptions |= OPTIONS_MPTCP_MPJ;
127126
if (opsize == TCPOLEN_MPTCP_MPJ_SYN) {
127+
mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYN;
128128
mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP;
129129
mp_opt->join_id = *ptr++;
130130
mp_opt->token = get_unaligned_be32(ptr);
@@ -135,6 +135,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,
135135
mp_opt->backup, mp_opt->join_id,
136136
mp_opt->token, mp_opt->nonce);
137137
} else if (opsize == TCPOLEN_MPTCP_MPJ_SYNACK) {
138+
mp_opt->suboptions |= OPTION_MPTCP_MPJ_SYNACK;
138139
mp_opt->backup = *ptr++ & MPTCPOPT_BACKUP;
139140
mp_opt->join_id = *ptr++;
140141
mp_opt->thmac = get_unaligned_be64(ptr);
@@ -145,11 +146,10 @@ static void mptcp_parse_option(const struct sk_buff *skb,
145146
mp_opt->backup, mp_opt->join_id,
146147
mp_opt->thmac, mp_opt->nonce);
147148
} else if (opsize == TCPOLEN_MPTCP_MPJ_ACK) {
149+
mp_opt->suboptions |= OPTION_MPTCP_MPJ_ACK;
148150
ptr += 2;
149151
memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN);
150152
pr_debug("MP_JOIN hmac");
151-
} else {
152-
mp_opt->suboptions &= ~OPTIONS_MPTCP_MPJ;
153153
}
154154
break;
155155

0 commit comments

Comments
 (0)