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 983A2325711 for ; Tue, 3 Feb 2026 17:37:25 +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=1770140245; cv=none; b=kTOQJpCopGW+ofpv4RYCisFAJDC/UtE7jOtkTvp92LArcjVQoLu0phbCn59qA/wyn7rDhEgT/8gquT6IXUel1lbNvLKFLVefPZDjlG5goW9Qzh+V7rA2vtDbbOYTQtm8Z9154Bu56Mdt9rlCKgHGvvpWVKDmZMi5PqIpAEN/V8w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770140245; c=relaxed/simple; bh=bxB1+xpOUbY64HrOy9rEbPCqQ/fStipfbx5HC7WhSxE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A64FfCSxF42XaZJFva0FDZ/0XSePp5T432FL7Yogd7XbjfL0D88KfnybXF9h+4LaK+XGFTjQKSPxyhHpqtpn0NFccineNv43cR+T6m+MGqy/7qLpSUGObeIJFzjwiw9idHDIJjz1FxE0kjw770BFSqqetEY1irCtbTtTI6OFZUU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CcWrZ1Id; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CcWrZ1Id" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8093CC116D0; Tue, 3 Feb 2026 17:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770140245; bh=bxB1+xpOUbY64HrOy9rEbPCqQ/fStipfbx5HC7WhSxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CcWrZ1Id/mpeDNOxu1UL8TeTNbH1RXpUPyD9jh3PTTLar0R8C2ejzKLNbV4+GZ+zF BQPJ4xUOjTndcJrYl63q0Clx+/RxTQ+36qtZ56dZH1/vLm8ZVov94ZCt2TSHoaXRyH kUQPgxuyfi7oomsRT7rIFPMDKYFZLeS7w+wvC48K+W/o8rEVyOUBDNbV1E5orNAU14 kN8Rcs8sA/lzqZHv4LtMfWQ5WGeU3rTkR+IjH7Fmt7IWI5asCjAW9+zhd9JdBzuxL4 poxQuiwwE8UU6SMCmE4U2P2wyejRpB8a7CTT7E9ZUiGsKbA5E3kwshu08n/qHWcNg0 NuOtEROYByHDw== From: Sasha Levin To: stable@vger.kernel.org Cc: "Matthieu Baerts (NGI0)" , Marco Angaroni , Geliang Tang , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.18.y] mptcp: avoid dup SUB_CLOSED events after disconnect Date: Tue, 3 Feb 2026 12:37:17 -0500 Message-ID: <20260203173717.1335686-1-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <2026020359-trusting-retrain-350e@gregkh> References: <2026020359-trusting-retrain-350e@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Matthieu Baerts (NGI0)" [ 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 Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/603 Reviewed-by: Geliang Tang Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20260127-net-mptcp-dup-nl-events-v1-1-7f71e1bc4feb@kernel.org Signed-off-by: Jakub Kicinski [ Adjust context ] Signed-off-by: Sasha Levin --- 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 d4e3111ba643f..dde483088aef8 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2533,8 +2533,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.51.0