From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 AC5623AFB1B for ; Thu, 17 Sep 2026 03:35:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789616161; cv=none; b=qYOH4i88UmeOT31FtbV70V5KKWe3KyecArOoot2zEFmppcgbQmq3CX4cmVrdrItyyo1f7GA/lvXcZo1RdhGQc4bcKZBP/Bey29V5w6fijAgHsTJpt7lyUG24jEriOOoHGRMvtm0jSZhZ8co+lEPIBJK0wwNgZ0iNEh/cnPZYklQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789616161; c=relaxed/simple; bh=i08O26jczd8qh8GAUnIXnJXn0yxjCLUGD3/3B98xb+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Zy+iwK+2dqrh2R9pgguubmRvohlpfTCa4zcjFJDEzPxl4/6+DI+Xk5eAvE0d3rlHNiMc+ZI5xbEeW+wvQwWGhz4p2xD16GLweygbEhfBfWm0ozgW+3zJsrjtSOlZ7As20kPI7nQUjuDrQU0y+/wINfvq1K9T5QZEME8BWjKJREY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yuj7g2dI; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Yuj7g2dI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DB371F0089C; Thu, 17 Sep 2026 03:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789616142; bh=I/jTttagJTsfnbH2YpMccwuUopKVhJOl2NjU44iJknw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Yuj7g2dIwRHT0r9gxOh91CBiq0oD8a8aZbuUdavmDlzwsZ1xeYcxxskHYi2KbOgWp AFp19YGU7jvyvk0+X7Hvdk2IiCyausGKjORUZz06cCgY3OCFnlCHPMb05E/CX82Cw1 X2V0Rdlek3aWafVgsu5/3vO8JlDJVa5x19EAu7nJk6hhlj2BLrNupkiH6g6SUuwT8Q /yAsr1dkXf4Zgzw6ILrTJsXKxbbsy+7HcFviEeOZ2UvyHhScKLZCu+WCwuVAp8/Yjo kvii+muMjzj6K4GpEzx/emoFQt9Tf13r8V9EDjW2ffse4ZRAf64JcrA3rnc6JHm98G SyFW1h0sidg2Q== From: Sasha Levin To: stable@vger.kernel.org Cc: Paolo Abeni , "Matthieu Baerts (NGI0)" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12.y 2/2] mptcp: do not reschedule the RTX timer for fallback sockets Date: Wed, 16 Sep 2026 23:35:39 -0400 Message-ID: <20260917033540.4044591-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917033540.4044591-1-sashal@kernel.org> References: <2026091614-glory-fiftieth-da3b@gregkh> <20260917033540.4044591-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Paolo Abeni [ Upstream commit e2ab913f68c7d11e2561b8a8ad0b87ffefcad667 ] On fallback socket the retrans timer is a quite convoluted no-op, but currently nothing prevents the MPTCP core to keep rescheduling it. Additionally gate RTX timer reset to the msk not being fallen back to TCP yet. To avoid adding multiple tests in fast-path, use a new flags bit for such condition. The RTX enable bit is clear at close time and set before the msk could start retransmitting, with a couple of caveats: - passive sockets inherit the bit from the listener msk; set the bit on such socket to avoid flipping it in the fast-path, even if the listener will obviously never retransmit. - while fastopening (MPTFO), mptcp_sendmsg_fastopen still ends-up calling mptcp_connect via tcp_sendmsg_fastopen -> __inet_stream_connect(ssk->sk_socket), and the first subflow's sk_socket points to the msk one. Fixes: b51f9b80c032 ("mptcp: introduce MPTCP retransmission timer") Cc: stable@vger.kernel.org Signed-off-by: Paolo Abeni Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20260908-net-mptcp-misc-fixes-7-3-rc1-v2-1-df1de70348b6@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/mptcp/protocol.c | 13 ++++++++++--- net/mptcp/protocol.h | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index fa77eb4ad201b..d86696807020e 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -82,6 +82,7 @@ bool __mptcp_try_fallback(struct mptcp_sock *msk, int fb_mib) msk->allow_subflows = false; set_bit(MPTCP_FALLBACK_DONE, &msk->flags); + clear_bit(MPTCP_RTX_ENABLED, &msk->flags); __MPTCP_INC_STATS(net, fb_mib); spin_unlock_bh(&msk->fallback_lock); return true; @@ -993,13 +994,14 @@ static bool mptcp_rtx_timer_pending(struct sock *sk) static void mptcp_reset_rtx_timer(struct sock *sk) { + struct mptcp_sock *msk = mptcp_sk(sk); unsigned long tout; - /* prevent rescheduling on close */ - if (unlikely(inet_sk_state_load(sk) == TCP_CLOSE)) + /* Prevent rescheduling on close and in case of fallback. */ + if (!test_bit(MPTCP_RTX_ENABLED, &msk->flags)) return; - tout = mptcp_sk(sk)->timer_ival; + tout = msk->timer_ival; sk_reset_timer(sk, &sk->mptcp_retransmit_timer, jiffies + tout); } @@ -3119,6 +3121,9 @@ void mptcp_set_state(struct sock *sk, int state) * transition from TCP_SYN_RECV to TCP_CLOSE_WAIT. */ break; + case TCP_CLOSE: + clear_bit(MPTCP_RTX_ENABLED, &mptcp_sk(sk)->flags); + fallthrough; default: if (oldstate == TCP_ESTABLISHED || oldstate == TCP_CLOSE_WAIT) MPTCP_DEC_STATS(sock_net(sk), MPTCP_MIB_CURRESTAB); @@ -3942,6 +3947,7 @@ static int mptcp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) if (IS_ERR(ssk)) return PTR_ERR(ssk); + set_bit(MPTCP_RTX_ENABLED, &msk->flags); mptcp_set_state(sk, TCP_SYN_SENT); subflow = mptcp_subflow_ctx(ssk); #ifdef CONFIG_TCP_MD5SIG @@ -4090,6 +4096,7 @@ static int mptcp_listen(struct socket *sock, int backlog) goto unlock; } + set_bit(MPTCP_RTX_ENABLED, &msk->flags); mptcp_set_state(sk, TCP_LISTEN); sock_set_flag(sk, SOCK_RCU_FREE); diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index defb5563d176c..d85eb3982a3ab 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -116,6 +116,7 @@ #define MPTCP_WORK_RTX 1 #define MPTCP_FALLBACK_DONE 2 #define MPTCP_WORK_CLOSE_SUBFLOW 3 +#define MPTCP_RTX_ENABLED 4 /* MPTCP socket release cb flags */ #define MPTCP_PUSH_PENDING 1 -- 2.53.0