All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: Matthieu Baerts <matttbe@kernel.org>,
	Mat Martineau <martineau@kernel.org>,
	 Geliang Tang <geliang.tang@linux.dev>,
	Florian Westphal <fw@strlen.de>,
	netdev@vger.kernel.org,  eric.dumazet@gmail.com,
	Eric Dumazet <edumazet@google.com>,
	 Peter Krystad <peter.krystad@linux.intel.com>
Subject: [PATCH net 2/5] mptcp: strict validation before using mp_opt->hmac
Date: Thu, 11 Jan 2024 19:49:14 +0000	[thread overview]
Message-ID: <20240111194917.4044654-3-edumazet@google.com> (raw)
In-Reply-To: <20240111194917.4044654-1-edumazet@google.com>

mp_opt->hmac contains uninitialized data unless OPTION_MPTCP_MPJ_ACK
was set in mptcp_parse_option().

We must refine the condition before we call subflow_hmac_valid().

Fixes: f296234c98a8 ("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>
---
 net/mptcp/subflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 3eacd04e7099e6de1a161c176a74959722445286..bb05477006a6ea111b7fc79645099dfa924e4135 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -788,7 +788,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
 
 	} else if (subflow_req->mp_join) {
 		mptcp_get_options(skb, &mp_opt);
-		if (!(mp_opt.suboptions & OPTIONS_MPTCP_MPJ) ||
+		if (!(mp_opt.suboptions & OPTION_MPTCP_MPJ_ACK) ||
 		    !subflow_hmac_valid(req, &mp_opt) ||
 		    !mptcp_can_accept_new_subflow(subflow_req->msk)) {
 			SUBFLOW_REQ_INC_STATS(req, MPTCP_MIB_JOINACKMAC);
-- 
2.43.0.275.g3460e3d667-goog


  parent reply	other threads:[~2024-01-11 19:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-11 19:49 [PATCH net 0/5] mptcp: better validation of MPTCPOPT_MP_JOIN option Eric Dumazet
2024-01-11 19:49 ` [PATCH net 1/5] mptcp: mptcp_parse_option() fix for MPTCPOPT_MP_JOIN Eric Dumazet
2024-01-12 19:35   ` Simon Horman
2024-01-11 19:49 ` Eric Dumazet [this message]
2024-01-12 19:36   ` [PATCH net 2/5] mptcp: strict validation before using mp_opt->hmac Simon Horman
2024-01-11 19:49 ` [PATCH net 3/5] mptcp: use OPTION_MPTCP_MPJ_SYNACK in subflow_finish_connect() Eric Dumazet
2024-01-12 19:36   ` Simon Horman
2024-01-11 19:49 ` [PATCH net 4/5] mptcp: use OPTION_MPTCP_MPJ_SYN in subflow_check_req() Eric Dumazet
2024-01-12 19:37   ` Simon Horman
2024-01-11 19:49 ` [PATCH net 5/5] mptcp: refine opt_mp_capable determination Eric Dumazet
2024-01-12 18:58   ` Mat Martineau
2024-01-12 19:37   ` Simon Horman
2024-01-12 17:43 ` [PATCH net 0/5] mptcp: better validation of MPTCPOPT_MP_JOIN option Paolo Abeni
2024-01-12 18:53 ` Mat Martineau
2024-01-13  2:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240111194917.4044654-3-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=geliang.tang@linux.dev \
    --cc=kuba@kernel.org \
    --cc=martineau@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peter.krystad@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.