From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D012B6D00 for ; Thu, 27 May 2021 23:54:39 +0000 (UTC) IronPort-SDR: G8hYYLHtgEjxA8nvobEIdRwg0Q4o5fOgRQp5XmYX87G4ty1EtFlxHYicgviiHl7g6HaWi5r0sq aC7hBdt1KShA== X-IronPort-AV: E=McAfee;i="6200,9189,9997"; a="288450522" X-IronPort-AV: E=Sophos;i="5.83,228,1616482800"; d="scan'208";a="288450522" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 16:54:36 -0700 IronPort-SDR: i/cP02B108gLUa6hcKH6bKyPB4kv5p3sq+M45pMuWP00+ZiOG1wVQM5iQGL+lpBzegjHPvtsQr Z4T2P11TCczg== X-IronPort-AV: E=Sophos;i="5.83,228,1616482800"; d="scan'208";a="443774252" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.209.84.136]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 16:54:36 -0700 From: Mat Martineau To: netdev@vger.kernel.org Cc: Jianguo Wu , davem@davemloft.net, kuba@kernel.org, matthieu.baerts@tessares.net, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 3/7] mptcp: generate subflow hmac after mptcp_finish_join() Date: Thu, 27 May 2021 16:54:26 -0700 Message-Id: <20210527235430.183465-4-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210527235430.183465-1-mathew.j.martineau@linux.intel.com> References: <20210527235430.183465-1-mathew.j.martineau@linux.intel.com> X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Jianguo Wu 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 Signed-off-by: Mat Martineau --- net/mptcp/subflow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index a50a97908866..2a58503e55bd 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -430,15 +430,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); -- 2.31.1