From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1C5471C1ADB; Mon, 22 Sep 2025 19:39:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758569976; cv=none; b=hmHvvUtl/YZPej6IHNgGpFB82QOYiPUuG1P/qb1C3QdqaZeSGBMY6mpXfSsnZw72aYoFFtps9gxyTyhEg32lN5K2MwlMJYJFXUf63Wo0JBjSWOOWJ7K8hzGiU35l9rsfIVEuiQ04S1P5aBKHR3ehXNd0KKChY+DzRFm22rZ1s8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758569976; c=relaxed/simple; bh=oqUMBEz65Cw/yV7ly/dgR3c+iHXdjoLlT9o+noAj8qw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f3HhILV+kw9RDRR82uXuTfRY9nCM25RVhblaeem+AEWnWGGTJ9hFwm5gwxwT1QmTCAaPX/354I194uYdHwb6/aDf4KlgDsmAr9brv0qkjdFHn8bxKCAkYwWKTvFuukSGiPMvIxj4Uye5pmzmi+b/VFTjmZ8jkySJMIo660Fm2ZU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vALcySVV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vALcySVV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A51A1C4CEF0; Mon, 22 Sep 2025 19:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758569976; bh=oqUMBEz65Cw/yV7ly/dgR3c+iHXdjoLlT9o+noAj8qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vALcySVV6kBES36IHtuolAiIWWhlquUWqFk09eXeXNoTyOpjk12T6b35pgLnaE1jz L69oDalNxrNtlWBdZwHlpU4gi7yiuTZrpESw+TazJaMLe9w7zb7w7p7UobRRik9O2y h2R8AgWvSgKtzk7DrupZL2rGFfQcNKMMlStLlJ5Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mat Martineau , Geliang Tang , "Matthieu Baerts (NGI0)" , Jakub Kicinski Subject: [PATCH 6.12 062/105] mptcp: propagate shutdown to subflows when possible Date: Mon, 22 Sep 2025 21:29:45 +0200 Message-ID: <20250922192410.539702554@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250922192408.913556629@linuxfoundation.org> References: <20250922192408.913556629@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthieu Baerts (NGI0) commit f755be0b1ff429a2ecf709beeb1bcd7abc111c2b upstream. When the MPTCP DATA FIN have been ACKed, there is no more MPTCP related metadata to exchange, and all subflows can be safely shutdown. Before this patch, the subflows were actually terminated at 'close()' time. That's certainly fine most of the time, but not when the userspace 'shutdown()' a connection, without close()ing it. When doing so, the subflows were staying in LAST_ACK state on one side -- and consequently in FIN_WAIT2 on the other side -- until the 'close()' of the MPTCP socket. Now, when the DATA FIN have been ACKed, all subflows are shutdown. A consequence of this is that the TCP 'FIN' flag can be set earlier now, but the end result is the same. This affects the packetdrill tests looking at the end of the MPTCP connections, but for a good reason. Note that tcp_shutdown() will check the subflow state, so no need to do that again before calling it. Fixes: 3721b9b64676 ("mptcp: Track received DATA_FIN sequence number and add related helpers") Cc: stable@vger.kernel.org Fixes: 16a9a9da1723 ("mptcp: Add helper to process acks of DATA_FIN") Reviewed-by: Mat Martineau Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20250912-net-mptcp-fix-sft-connect-v1-1-d40e77cbbf02@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/mptcp/protocol.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -413,6 +413,20 @@ static void mptcp_close_wake_up(struct s sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); } +static void mptcp_shutdown_subflows(struct mptcp_sock *msk) +{ + struct mptcp_subflow_context *subflow; + + mptcp_for_each_subflow(msk, subflow) { + struct sock *ssk = mptcp_subflow_tcp_sock(subflow); + bool slow; + + slow = lock_sock_fast(ssk); + tcp_shutdown(ssk, SEND_SHUTDOWN); + unlock_sock_fast(ssk, slow); + } +} + /* called under the msk socket lock */ static bool mptcp_pending_data_fin_ack(struct sock *sk) { @@ -437,6 +451,7 @@ static void mptcp_check_data_fin_ack(str break; case TCP_CLOSING: case TCP_LAST_ACK: + mptcp_shutdown_subflows(msk); mptcp_set_state(sk, TCP_CLOSE); break; } @@ -605,6 +620,7 @@ static bool mptcp_check_data_fin(struct mptcp_set_state(sk, TCP_CLOSING); break; case TCP_FIN_WAIT2: + mptcp_shutdown_subflows(msk); mptcp_set_state(sk, TCP_CLOSE); break; default: