Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Paolo Abeni <pabeni@redhat.com>,
	Mat Martineau <mathew.j.martineau@linux.intel.com>,
	Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 1/2] mptcp: strict local address ID selection
Date: Wed, 16 Sep 2026 23:04:04 -0400	[thread overview]
Message-ID: <20260917030405.3945919-1-sashal@kernel.org> (raw)
In-Reply-To: <2026091645-harmful-flannels-71f9@gregkh>

From: Paolo Abeni <pabeni@redhat.com>

[ Upstream commit 4cf86ae84c718333928fd2d43168a1e359a28329 ]

The address ID selection for MPJ subflows created in response
to incoming ADD_ADDR option is currently unreliable: it happens
at MPJ socket creation time, when the local address could be
unknown.

Additionally, if the no local endpoint is available for the local
address, a new dummy endpoint is created, confusing the user-land.

This change refactor the code to move the address ID selection inside
the rebuild_header() helper, when the local address eventually
selected by the route lookup is finally known. If the address used
is not mapped by any endpoint - and thus can't be advertised/removed
pick the id 0 instead of allocate a new endpoint.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

[5.15 dependency adaptation]
Retain only the passive MP_JOIN clone preparation needed for
29f641951be0d91036d77edf677807f1447dbe65 ("mptcp: subflow: no need to
copy thmac during ulp_clone"). Move the existing local_id assignment
below thmac and retain the upstream comment about the validated request
ID. Use the existing direct assignment instead of adding
subflow_set_local_id(), and match the target's adjacent WRITE_ONCE()
remote_id assignment so its unmodified patch applies cleanly.

Omit the active-open address selection refactor, rebuild_header hooks,
local_id_valid field and initialization, and path-manager changes. They
are unnecessary for the thmac fix and would require new helper functions.
The stable branch's existing address selection and initialization are
preserved. This preparatory dependency intentionally leaves the thmac
copy in place for the target commit to remove.

[ sashal: Reduced backport -- upstream 4cf86ae84c718 touches 4 file(s), this
  backport carries 1. Not backported here:
  net/mptcp/pm_netlink.c
  net/mptcp/protocol.c
  net/mptcp/protocol.h
  This note is generated from the file lists only; see the resolution record
  for the reasoning. ]

Stable-dep-of: 29f641951be0 ("mptcp: subflow: no need to copy thmac during ulp_clone")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 net/mptcp/subflow.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index c9cf0fdbfbdca..55bd5ecc9e7a8 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -1415,10 +1415,14 @@ static void subflow_ulp_clone(const struct request_sock *req,
 		new_ctx->fully_established = 1;
 		new_ctx->backup = subflow_req->backup;
 		new_ctx->request_bkup = subflow_req->request_bkup;
-		new_ctx->local_id = subflow_req->local_id;
-		new_ctx->remote_id = subflow_req->remote_id;
+		WRITE_ONCE(new_ctx->remote_id, subflow_req->remote_id);
 		new_ctx->token = subflow_req->token;
 		new_ctx->thmac = subflow_req->thmac;
+
+		/* the subflow req id is valid, fetched via subflow_check_req()
+		 * and subflow_token_join_request()
+		 */
+		new_ctx->local_id = subflow_req->local_id;
 	}
 }
 
-- 
2.53.0


  reply	other threads:[~2026-09-17  3:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 16:29 FAILED: patch "[PATCH] mptcp: subflow: no need to copy thmac during ulp_clone" failed to apply to 5.10-stable tree gregkh
2026-09-17  3:04 ` Sasha Levin [this message]
2026-09-17  3:04   ` [PATCH 5.10.y 2/2] mptcp: subflow: no need to copy thmac during ulp_clone Sasha Levin

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=20260917030405.3945919-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=kuba@kernel.org \
    --cc=mathew.j.martineau@linux.intel.com \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox