From nobody Sat Sep 5 05:48:24 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 C176940BCD4 for ; Fri, 28 Aug 2026 10:18:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787912303; cv=none; b=bHxYxH/0ZSzSv4yn4j/4dcsZC/4gnwmpyRRXNV1COkszatN6MmclRgYPutXxlFGMsXsHj0Q5+s9xwvdmXppi4ogB9WlMBwYlXBRCyhN6THocduPZC71c9WDFnQLC+d0mrPtyqmDMK9N+FBRTN0xMNkzImMNlbJfCJAkXXUlftUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787912303; c=relaxed/simple; bh=BjW9VQ11NnowZovp2lrhRcsaSj4FRziEM7/tWxlmVLk=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=jNWMOZStWXdoJFmo3yzEvH6C2u4xIwuQX1Jm7GghPQOsUIBcVxUB4wU1kHI/YM2+Vy2tgfNrdqAvaYOsG1Z/dSR6sGwqHsG+nwaCJ13UBRaCmpxkUfbVNnGefNL9Th21oXsnxQ/FLO2IBujEjZiPZ4sUKsrY9y04TgzLRtf0C04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YMMhfo1b; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YMMhfo1b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787912299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZK1iz8HqIHe2tu0lgBEKE1OskBVA0+cHAy0MGvD7zps=; b=YMMhfo1ba8peUiX9XabFk3l0VHmXdCvmn+Cl59QaPH+AEU19WfVGmhVPokpxOoZ4KCdtYm D2gxd78NPQ+tpLpthIUgBTfbfBavDUGuJcjiWOTpbIS4PMb+rqOcYqeWW+zFaK2iUsDX5h DCubN5vt8s39ztRzeyrHmjuCLZQpebk= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-244-9c-ZcAhaM9uRxZLHU3Ux3Q-1; Fri, 28 Aug 2026 06:18:17 -0400 X-MC-Unique: 9c-ZcAhaM9uRxZLHU3Ux3Q-1 X-Mimecast-MFC-AGG-ID: 9c-ZcAhaM9uRxZLHU3Ux3Q_1787912296 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C23711802648 for ; Fri, 28 Aug 2026 10:18:16 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.44.48.20]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0E2AD3000223 for ; Fri, 28 Aug 2026 10:18:15 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v3 1/2] mptcp: prevent race between disconnect() and rtx Date: Fri, 28 Aug 2026 12:17:13 +0200 Message-ID: In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ZOW1ssMMQujF_FVO4q0JZEeD7pa9_zwLuvKTvhM-prE_1787912296 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Sashiko noted that the two event can race, leading to inconsistent status. Prevent the race using the synchronous timer stop operation. Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation") Signed-off-by: Paolo Abeni --- 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 f22d64ab1c53..1e7e59d497c5 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3625,6 +3625,7 @@ static void mptcp_destroy_common(struct mptcp_sock *m= sk) =20 static int mptcp_disconnect(struct sock *sk, int flags) { + struct inet_connection_sock *icsk =3D inet_csk(sk); struct mptcp_sock *msk =3D mptcp_sk(sk); =20 /* We are on the fastopen error path. We can't call straight into the @@ -3637,8 +3638,13 @@ static int mptcp_disconnect(struct sock *sk, int fla= gs) mptcp_check_listen_stop(sk); mptcp_set_state(sk, TCP_CLOSE); =20 - 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 =3D icsk->icsk_rto_min; + sk_stop_timer_sync(sk, &sk->mptcp_retransmit_timer); + icsk->icsk_mtup.probe_timestamp =3D 0; + sk_stop_timer_sync(sk, &icsk->mptcp_tout_timer); =20 mptcp_pm_connection_closed(msk); =20 --=20 2.55.0 From nobody Sat Sep 5 05:48:24 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 F06153E5598 for ; Fri, 28 Aug 2026 10:18:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787912305; cv=none; b=CJ0CJL/FF79146FYrboiQTpRcvarRd/sffNFKg8mzTbySGHIhTw105RAqNWmKxDs1jUB8XMP3NivYLQNMVSD7dnsNaKeFUgU0TP+zs0HDvwsJGnVz9GL0y/EaDnJfcHuCK6USToRx6pySysKX0qOljdTWJiuKOgfQ/wrsbsdfPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787912305; c=relaxed/simple; bh=wWkmHEZF0pc+fXcQSL8EYCoH/0PecPjJp07eqIJ9B9E=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:content-type; b=r9skCXyR5fcJQpEWMeLfq8787V2RBaJAX7uc9aqNGVB2+tzouGY+27MI/LXJTYQ4OX1FE1kJv5dAuEohCmUfbBI9TDi3ACxacwTs+LO2f+U+K49GsNsfUwVL4foSPG8SD23SyOko8XTjafvCWH+uBYSjKXFmOT04ezQ9CEeWUI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=EZVGelJf; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="EZVGelJf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787912300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RQwKfd6jIJ8KE3EPtGle4t17zrsYhCY8X3uL40KvQ0c=; b=EZVGelJf11/Uu3IyPA50amAjPSLSCo5KdLOiU0zaXepclQVIyke4yWu1+zVeaaBCgMfEWg jPBtdvlWGUoOQmf7W+fgAXmbum2oc3beqR5hSTiVUqBrQcx+OSmvjBtBvKwUFgV0WDNy/u Nyw5UIs5HX5lnRd096AD0elbHNB+lbc= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-442-IX_ccPhvNRerYnBkwV4Ssw-1; Fri, 28 Aug 2026 06:18:19 -0400 X-MC-Unique: IX_ccPhvNRerYnBkwV4Ssw-1 X-Mimecast-MFC-AGG-ID: IX_ccPhvNRerYnBkwV4Ssw_1787912298 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3315C185FD81 for ; Fri, 28 Aug 2026 10:18:18 +0000 (UTC) Received: from gerbillo.redhat.com (unknown [10.44.48.20]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5CDF93001D37 for ; Fri, 28 Aug 2026 10:18:17 +0000 (UTC) From: Paolo Abeni To: mptcp@lists.linux.dev Subject: [PATCH mptcp-net v3 2/2] Squash-to: "mptcp: do not reschedule the RTX timer for fallback sockets" Date: Fri, 28 Aug 2026 12:17:14 +0200 Message-ID: <18efc48d4288baa509ab8305e24c1c8b10d78b16.1787911017.git.pabeni@redhat.com> In-Reply-To: References: Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 4FhDCoYKmcxACMomlcUTLWLqH7r9_MF4BrcBYtldVN0_1787912298 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8"; x-default="true" Sashiko noted that the 'RTX disabled' status is carried over across connect() failures, potentially to subsequent successful connect() or listen(). Explicitly control the RTX enabling status across the whole msk life-cycle. To make the code more straight forward switch the newly introduced flag semantic. To be appended to the squash-to commit message: """ 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, mptcp_sendmsg_fastopen still ends-up calling mptcp_connect via tcp_sendmsg_fastopen -> __inet_stream_connect(ssk->sk_socket), and the first subflow sk_socket points to the msk one. """ Signed-off-by: Paolo Abeni --- v2 -> v3: - roll back to v1, sashiko review was wrong and I should have noticed :( hopefully the update changelog should guide sashiko review to avoid repeating the sloop, in any case the issue reported here: https://sashiko.dev/#/patchset/f1e8ffe44c3756195391a25ecf60e56e02e0f34f.178= 7739122.git.pabeni%40redhat.com is a false positive (see the above changelog). v1 -> v2: - consolidate enable, fix missing enable for fastopen --- net/mptcp/protocol.c | 8 +++++--- net/mptcp/protocol.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 1e7e59d497c5..08e06511cd6f 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -96,7 +96,7 @@ bool __mptcp_try_fallback(struct mptcp_sock *msk, int fb_= mib) =20 msk->allow_subflows =3D false; set_bit(MPTCP_FALLBACK_DONE, &msk->flags); - set_bit(MPTCP_RTX_DISABLED, &msk->flags); + clear_bit(MPTCP_RTX_ENABLED, &msk->flags); __MPTCP_INC_STATS(net, fb_mib); spin_unlock_bh(&msk->fallback_lock); return true; @@ -1126,7 +1126,7 @@ static void mptcp_reset_rtx_timer(struct sock *sk) unsigned long tout; =20 /* Prevent rescheduling on close and in case of fallback. */ - if (test_bit(MPTCP_RTX_DISABLED, &msk->flags)) + if (!test_bit(MPTCP_RTX_ENABLED, &msk->flags)) return; =20 tout =3D msk->timer_ival; @@ -3363,7 +3363,7 @@ void mptcp_set_state(struct sock *sk, int state) */ break; case TCP_CLOSE: - set_bit(MPTCP_RTX_DISABLED, &mptcp_sk(sk)->flags); + clear_bit(MPTCP_RTX_ENABLED, &mptcp_sk(sk)->flags); fallthrough; default: if (oldstate =3D=3D TCP_ESTABLISHED || oldstate =3D=3D TCP_CLOSE_WAIT) @@ -4189,6 +4189,7 @@ static int mptcp_connect(struct sock *sk, struct sock= addr_unsized *uaddr, if (IS_ERR(ssk)) return PTR_ERR(ssk); =20 + set_bit(MPTCP_RTX_ENABLED, &msk->flags); mptcp_set_state(sk, TCP_SYN_SENT); subflow =3D mptcp_subflow_ctx(ssk); #ifdef CONFIG_TCP_MD5SIG @@ -4336,6 +4337,7 @@ static int mptcp_listen(struct socket *sock, int back= log) goto unlock; } =20 + set_bit(MPTCP_RTX_ENABLED, &msk->flags); mptcp_set_state(sk, TCP_LISTEN); sock_set_flag(sk, SOCK_RCU_FREE); =20 diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 3d250e8204d5..482d4a549881 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -116,7 +116,7 @@ #define MPTCP_WORK_RTX 1 #define MPTCP_FALLBACK_DONE 2 #define MPTCP_WORK_CLOSE_SUBFLOW 3 -#define MPTCP_RTX_DISABLED 4 +#define MPTCP_RTX_ENABLED 4 =20 /* MPTCP socket release cb flags */ #define MPTCP_PUSH_PENDING 1 --=20 2.55.0