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 CBB002877FA; Tue, 22 Jul 2025 13:58:41 +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=1753192721; cv=none; b=TUAj+AIG3TQ65ZmJ5ICx2YCJ6ckD70BlTKTpzJLUKF64jl9G9VsbcADkOPj9mb9icGEX44uW1Gi/03kXDRlF5NJsutX+8EmrmurcdIP55b6J39aFN/8CBnOjnFmyhS9ILv+hLyN06HDTYwn6l+wvkH0MEXDtl6chzbrfaaGTRO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753192721; c=relaxed/simple; bh=Y1e9DpiA9jQY+SElKuH9AxBuDmXK8MIiLqn5hPva4dk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FWcH63pKJaQ4+nrEwYOBifq+MamcK0EA01pT93MSreDBdmawYv9enaKcaYR6GONy/Mzo0ZyQv0wphoTtfrkGEv9MuD8/exZYY7GfbKLtEhcMO8x1dHP39dSTob/KKYhWi4oioZjvPAZQTds1MZuVVrZ8IZ4qC4obFTODAGLlVN8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=OJkISgWY; 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="OJkISgWY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5355CC4CEEB; Tue, 22 Jul 2025 13:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1753192721; bh=Y1e9DpiA9jQY+SElKuH9AxBuDmXK8MIiLqn5hPva4dk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OJkISgWYBJ8kHiebrmvMBv0iuFieFN9w7pGSIS7kAtsW1TPgrVWLSUyXSAiHiTyh+ rHU70ilRPTfwNX4QljxI4qZtOfUtTQNr3fiv4TeS0uG82rXS8jt/ZJnI1VpuiNC8Y5 5tM94/kCNodr+cHB/Rm/6B4ndmCZMGtPX1pW1044= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paolo Abeni , "Matthieu Baerts (NGI0)" , Jakub Kicinski Subject: [PATCH 6.12 038/158] mptcp: reset fallback status gracefully at disconnect() time Date: Tue, 22 Jul 2025 15:43:42 +0200 Message-ID: <20250722134342.165783979@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250722134340.596340262@linuxfoundation.org> References: <20250722134340.596340262@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev 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: Paolo Abeni commit da9b2fc7b73d147d88abe1922de5ab72d72d7756 upstream. mptcp_disconnect() clears the fallback bit unconditionally, without touching the associated flags. The bit clear is safe, as no fallback operation can race with that -- all subflow are already in TCP_CLOSE status thanks to the previous FASTCLOSE -- but we need to consistently reset all the fallback related status. Also acquire the relevant lock, to avoid fouling static analyzers. Fixes: b29fcfb54cd7 ("mptcp: full disconnect implementation") 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/20250714-net-mptcp-fallback-races-v1-3-391aff963322@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/mptcp/protocol.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -3249,7 +3249,16 @@ static int mptcp_disconnect(struct sock * subflow */ mptcp_destroy_common(msk, MPTCP_CF_FASTCLOSE); + + /* The first subflow is already in TCP_CLOSE status, the following + * can't overlap with a fallback anymore + */ + spin_lock_bh(&msk->fallback_lock); + msk->allow_subflows = true; + msk->allow_infinite_fallback = true; WRITE_ONCE(msk->flags, 0); + spin_unlock_bh(&msk->fallback_lock); + msk->cb_flags = 0; msk->recovery = false; WRITE_ONCE(msk->can_ack, false);