diff options
author | Jianguo Wu <wujianguo@chinatelecom.cn> | 2021-05-28 02:54:26 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-14 17:56:17 +0300 |
commit | 116d5cdfacff50a9a8bfcc2dfd16b4bbb270f261 (patch) | |
tree | 46bbeb9e5c286fb0aff04867c9deb41b93891dc0 | |
parent | 284e741c4e2ad9e0cba84dc63c3692c83f1e4b3d (diff) | |
download | linux-116d5cdfacff50a9a8bfcc2dfd16b4bbb270f261.tar.xz |
mptcp: generate subflow hmac after mptcp_finish_join()
[ Upstream commit 0a4d8e96e4fd687af92b961d5cdcea0fdbde05fe ]
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: ec3edaa7ca6c ("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>
-rw-r--r-- | net/mptcp/subflow.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 851fb3d8c791..bba5696fee36 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -338,15 +338,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); } else if (mptcp_check_fallback(sk)) { |