All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes
@ 2026-11-17  7:44 Eva Kurchatova
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure Eva Kurchatova
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Eva Kurchatova @ 2026-11-17  7:44 UTC (permalink / raw)
  To: khorenko; +Cc: devel

Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-155419

Matthieu Baerts (NGI0) (1):
  ms/mptcp: avoid dup SUB_CLOSED events after disconnect

Quanye Yang (1):
  ms/mptcp: reset msk state on early connect failure

 net/mptcp/protocol.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure
  2026-11-17  7:44 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Eva Kurchatova
@ 2026-11-17  7:44 ` Eva Kurchatova
  2026-11-17  7:51   ` no-reply
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect Eva Kurchatova
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Eva Kurchatova @ 2026-11-17  7:44 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: Quanye Yang <quanyeyang@proton.me>

[ Upstream commit 29afe67082b2d33ab2e90c56c337235d725f023f ]

mptcp_connect() can fall back before the subflow SYN is sent, for
example when the netns is in an MPTCP blackhole, token allocation fails,
or MD5SIG is in use. If the subsequent subflow connect() fails
immediately (EAFNOSUPPORT, ENETUNREACH, ...), __inet_stream_connect()
returns while the socket is still SS_UNCONNECTED and never calls
->disconnect(). This was reported by Clashiko [1].

The error path only dropped the token and moved the msk back to
TCP_CLOSE. MPTCP_FALLBACK_DONE, allow_subflows and
request_mptcp were left as after early fallback, so a later
connect() on the same fd stayed TCP-only.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/633 [1]
Fixes: 0235d075a592 ("mptcp: mark as fallback even early ones")
Cc: stable@vger.kernel.org
Signed-off-by: Quanye Yang <quanyeyang@proton.me>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20261013-net-mptcp-misc-fixes-7-3-rc8-v1-1-932c9b182fc7@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit d47337f3cb2156c674934c22a5ebce38aeecad2a)

https://virtuozzo.atlassian.net/browse/VSTOR-155419
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/mptcp/protocol.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 384ad1a8b5c0..62afc750db43 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3809,9 +3809,16 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	 * subflow_finish_connect()
 	 */
 	if (unlikely(err)) {
-		/* avoid leaving a dangling token in an unconnected socket */
 		mptcp_token_destroy(msk);
 		mptcp_set_state(sk, TCP_CLOSE);
+
+		spin_lock_bh(&msk->fallback_lock);
+		msk->allow_subflows = true;
+		msk->allow_infinite_fallback = true;
+		clear_bit(MPTCP_FALLBACK_DONE, &msk->flags);
+		spin_unlock_bh(&msk->fallback_lock);
+
+		mptcp_subflow_ctx_reset(mptcp_subflow_ctx(ssk));
 		return err;
 	}
 
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Devel] [PATCH hci-8.1 2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect
  2026-11-17  7:44 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Eva Kurchatova
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure Eva Kurchatova
@ 2026-11-17  7:44 ` Eva Kurchatova
  2026-11-17  7:51   ` no-reply
  2026-11-17 15:12 ` [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Konstantin Khorenko
  2026-11-17 15:13 ` Konstantin Khorenko
  3 siblings, 1 reply; 7+ messages in thread
From: Eva Kurchatova @ 2026-11-17  7:44 UTC (permalink / raw)
  To: khorenko; +Cc: devel

From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>

[ Upstream commit 280d654324e33f8e6e3641f76764694c7b64c5db ]

In case of subflow disconnect(), which can also happen with the first
subflow in case of errors like timeout or reset, mptcp_subflow_ctx_reset
will reset most fields from the mptcp_subflow_context structure,
including close_event_done. Then, when another subflow is closed, yet
another SUB_CLOSED event for the disconnected initial subflow is sent.
Because of the previous reset, there are no source address and
destination port.

A solution is then to also check the subflow's local id: it shouldn't be
negative anyway.

Another solution would be not to reset subflow->close_event_done at
disconnect time, but when reused. But then, probably the whole reset
could be done when being reused. Let's not change this logic, similar
to TCP with tcp_disconnect().

Fixes: d82809b6c5f2 ("mptcp: avoid duplicated SUB_CLOSED events")
Cc: stable@vger.kernel.org
Reported-by: Marco Angaroni <marco.angaroni@italtel.com>
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/603
Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260127-net-mptcp-dup-nl-events-v1-1-7f71e1bc4feb@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[ Adjust context ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 42c44bd729dcb651ee11de48cfde1e0d5ff0d963)

https://virtuozzo.atlassian.net/browse/VSTOR-155419
Feature: fix ms/net

Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
 net/mptcp/protocol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 62afc750db43..366a4b8167d8 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2472,8 +2472,8 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
 void mptcp_close_ssk(struct sock *sk, struct sock *ssk,
 		     struct mptcp_subflow_context *subflow)
 {
-	/* The first subflow can already be closed and still in the list */
-	if (subflow->close_event_done)
+	/* The first subflow can already be closed or disconnected */
+	if (subflow->close_event_done || READ_ONCE(subflow->local_id) < 0)
 		return;
 
 	subflow->close_event_done = true;
-- 
2.56.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure Eva Kurchatova
@ 2026-11-17  7:51   ` no-reply
  0 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2026-11-17  7:51 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

> From: Quanye Yang <quanyeyang@proton.me>
> 
> [ Upstream commit 29afe67082b2d33ab2e90c56c337235d725f023f ]
> 
> mptcp_connect() can fall back before the subflow SYN is sent, for
> example when the netns is in an MPTCP blackhole, token allocation fails,
> or MD5SIG is in use. If the subsequent subflow connect() fails
> immediately (EAFNOSUPPORT, ENETUNREACH, ...), __inet_stream_connect()
> returns while the socket is still SS_UNCONNECTED and never calls
> ->disconnect(). This was reported by Clashiko [1].
> 
> The error path only dropped the token and moved the msk back to
> TCP_CLOSE. MPTCP_FALLBACK_DONE, allow_subflows and
> request_mptcp were left as after early fallback, so a later
> connect() on the same fd stayed TCP-only.
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-155419
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261117074627.820727-1-eva.kurchatova@virtuozzo.com?part=1


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect Eva Kurchatova
@ 2026-11-17  7:51   ` no-reply
  0 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2026-11-17  7:51 UTC (permalink / raw)
  To: Eva Kurchatova, khorenko; +Cc: devel

> From: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
> 
> [ Upstream commit 280d654324e33f8e6e3641f76764694c7b64c5db ]
> 
> In case of subflow disconnect(), which can also happen with the first
> subflow in case of errors like timeout or reset, mptcp_subflow_ctx_reset
> will reset most fields from the mptcp_subflow_context structure,
> including close_event_done. Then, when another subflow is closed, yet
> another SUB_CLOSED event for the disconnected initial subflow is sent.
> Because of the previous reset, there are no source address and
> destination port.
> 
> A solution is then to also check the subflow's local id: it shouldn't be
> negative anyway.
> 
> [ ... ]
> 
> https://virtuozzo.atlassian.net/browse/VSTOR-155419
> Feature: fix ms/net
> 
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261117074627.820727-1-eva.kurchatova@virtuozzo.com?part=2


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes
  2026-11-17  7:44 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Eva Kurchatova
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure Eva Kurchatova
  2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect Eva Kurchatova
@ 2026-11-17 15:12 ` Konstantin Khorenko
  2026-11-17 15:13 ` Konstantin Khorenko
  3 siblings, 0 replies; 7+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 15:12 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

Applying as is.

On Tue, 17 Nov 2026 09:44:50 +0200, Eva Kurchatova wrote:
> Matthieu Baerts (NGI0) (1):
>   ms/mptcp: avoid dup SUB_CLOSED events after disconnect
>
> Quanye Yang (1):
>   ms/mptcp: reset msk state on early connect failure

Both are the 6.12.y commits, and both bugs are reachable here. The
series does not overlap with the stability and cc-stable series and
can go in at any point.

Separate patches, not needed for this series; I created a task:

1. Three more Cc stable fixes from the same upstream postings are
   missing: c9c90cf437a9e ("mptcp: hold MP_JOIN msk ref when cloning
   reqsk"), 2093bc7fa5005 ("mptcp: fix MP_CAPABLE token migration when
   cloning reqsk") and dccf46179ddd6 ("mptcp: only reset subflow
   errors when propagated").
   https://virtuozzo.atlassian.net/browse/VSTOR-155530

Thanks.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes
  2026-11-17  7:44 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Eva Kurchatova
                   ` (2 preceding siblings ...)
  2026-11-17 15:12 ` [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Konstantin Khorenko
@ 2026-11-17 15:13 ` Konstantin Khorenko
  3 siblings, 0 replies; 7+ messages in thread
From: Konstantin Khorenko @ 2026-11-17 15:13 UTC (permalink / raw)
  To: Eva Kurchatova; +Cc: devel

On Tue, 17 Nov 2026 09:44:50 +0200, Eva Kurchatova wrote:
> ms/mptcp: backport connection reset fixes
> 
> Patchset for task https://virtuozzo.atlassian.net/browse/VSTOR-155419
> 
> Matthieu Baerts (NGI0) (1):
>   ms/mptcp: avoid dup SUB_CLOSED events after disconnect
> 
> [...]

Applied to branch-rh10-6.12.0-211.75.1.26.x.vz10-ovz, will be released in rh10-6.12.0-211.75.1.24.3.vz10, thanks!

[1/2] ms/mptcp: reset msk state on early connect failure
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/daab25936d8c
[2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/26808dfbcd8c

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team


_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-17 15:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  7:44 [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Eva Kurchatova
2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 1/2] ms/mptcp: reset msk state on early connect failure Eva Kurchatova
2026-11-17  7:51   ` no-reply
2026-11-17  7:44 ` [Devel] [PATCH hci-8.1 2/2] ms/mptcp: avoid dup SUB_CLOSED events after disconnect Eva Kurchatova
2026-11-17  7:51   ` no-reply
2026-11-17 15:12 ` [Devel] [PATCH hci-8.1 0/2] ms/mptcp: backport connection reset fixes Konstantin Khorenko
2026-11-17 15:13 ` Konstantin Khorenko

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.