OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 2/4] ms/mptcp: prevent race between disconnect() and rtx
Date: Mon, 16 Nov 2026 20:03:02 +0200	[thread overview]
Message-ID: <20261116180419.685520-5-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20261116180419.685520-3-eva.kurchatova@virtuozzo.com>

From: Paolo Abeni <pabeni@redhat.com>

Sashiko noted that the two event can race, leading to inconsistent
status. Prevent the race using the synchronous timer stop operation.

Cc: stable@vger.kernel.org
Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-6-df1de70348b6@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 85c580b0d8590520ae00a15c29e9fb9c99427a3e)

Rebase note: this tree lacks commits 9a5e5334adc0 ("tcp: remove
icsk->icsk_retransmit_timer") and e4141ea18a73 ("tcp: introduce
icsk->icsk_keepalive_timer"), so the timers stopped are still
icsk_retransmit_timer and sk_timer. It also lacks commit ea4eb2adb0d3
("mptcp: honour configured min/max RTO in retransmit paths"), which
initialises icsk_rto_min, so timer_ival is reset to TCP_RTO_MIN, as in
__mptcp_init_sock() here and in the 6.12.y backport.

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

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

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 40d78fe6e111..1d4754b20cea 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3188,6 +3188,7 @@ static void mptcp_copy_inaddrs(struct sock *msk, const struct sock *ssk)
 
 static int mptcp_disconnect(struct sock *sk, int flags)
 {
+	struct inet_connection_sock *icsk = inet_csk(sk);
 	struct mptcp_sock *msk = mptcp_sk(sk);
 
 	/* We are on the fastopen error path. We can't call straight into the
@@ -3200,8 +3201,13 @@ static int mptcp_disconnect(struct sock *sk, int flags)
 	mptcp_check_listen_stop(sk);
 	mptcp_set_state(sk, TCP_CLOSE);
 
-	mptcp_stop_rtx_timer(sk);
-	mptcp_stop_tout_timer(sk);
+	/* The later subflow close can not kick again the tout timer,
+	 * as the msk is already in closed status.
+	 */
+	msk->timer_ival = TCP_RTO_MIN;
+	sk_stop_timer_sync(sk, &icsk->icsk_retransmit_timer);
+	icsk->icsk_mtup.probe_timestamp = 0;
+	sk_stop_timer_sync(sk, &sk->sk_timer);
 
 	mptcp_pm_connection_closed(msk);
 
-- 
2.56.1

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

  parent reply	other threads:[~2026-11-16 18:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 18:03 [Devel] [PATCH hci-8.1 0/4] ms/mptcp: backport cc-stable fixes Eva Kurchatova
2026-11-16 18:03 ` [Devel] [PATCH hci-8.1 1/4] ms/mptcp: reset rcv wnd on disconnect Eva Kurchatova
2026-11-16 18:09   ` no-reply
2026-11-17 11:29   ` Konstantin Khorenko
2026-11-16 18:03 ` Eva Kurchatova [this message]
2026-11-16 18:08   ` [Devel] [PATCH hci-8.1 2/4] ms/mptcp: prevent race between disconnect() and rtx no-reply
2026-11-17 11:29   ` Konstantin Khorenko
2026-11-16 18:03 ` [Devel] [PATCH hci-8.1 3/4] ms/mptcp: close race between scheduler and state change Eva Kurchatova
2026-11-16 18:10   ` no-reply
2026-11-16 18:03 ` [Devel] [PATCH hci-8.1 4/4] ms/mptcp: fix bad accounting in __mptcp_subflow_push_pending() Eva Kurchatova
2026-11-16 18:10   ` no-reply
2026-11-17 11:29 ` [Devel] [PATCH hci-8.1 0/4] ms/mptcp: backport cc-stable fixes Konstantin Khorenko

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=20261116180419.685520-5-eva.kurchatova@virtuozzo.com \
    --to=eva.kurchatova@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox