Skip to content

Commit

Permalink
mptcp: generate subflow hmac after mptcp_finish_join()
Browse files Browse the repository at this point in the history
[ Upstream commit 0a4d8e9 ]

For outgoing subflow join, when recv SYNACK, in subflow_finish_connect(),
the mptcp_finish_join() may return false in some cases, and send a RESET
to remote, and no local hmac is required.
So generate subflow hmac after mptcp_finish_join().

Fixes: ec3edaa ("mptcp: Add handling of outgoing MP_JOIN requests")
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Jianguo Wu authored and gregkh committed Jul 14, 2021
1 parent 6196541 commit b65f7e1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/mptcp/subflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,15 +409,15 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)
goto do_reset;
}

if (!mptcp_finish_join(sk))
goto do_reset;

subflow_generate_hmac(subflow->local_key, subflow->remote_key,
subflow->local_nonce,
subflow->remote_nonce,
hmac);
memcpy(subflow->hmac, hmac, MPTCPOPT_HMAC_LEN);

if (!mptcp_finish_join(sk))
goto do_reset;

subflow->mp_join = 1;
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_JOINSYNACKRX);

Expand Down

0 comments on commit b65f7e1

Please sign in to comment.