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 CF77D392C21; Tue, 25 Aug 2026 13:50:30 +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=1787665832; cv=none; b=bGQHqtPKK8fQGx4pFeHKhy+K436PkRpvNU/aEZLwx7nqBviF3fgjJRJjgAkzBGR8i3T+sS/s0Tqbm4uCnQa8jnRpsC5QuLaOO82aOeEMaDtDVn9x8lQMzlhS9aMwN0XgISIl/m8dstDFHuAlDDTDcAWMO0wpqglPttDfdUo18mk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787665832; c=relaxed/simple; bh=ffBYe3bSdZDlkuIoyk2M6hRCDqW/h6VxgdL7r8WvybY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fmYnuHL7rcQFpPiruod+d8IiqjP8spmUowUA0AuAQsbCBITDrFJlI0uOrJtpRrhTRHnF1Ph3014VDtnUDvVt5/Uur2p6r3X0EQ8XfCmT9HbBV8hlzrIiCUyBhsKnrGfRXhinni/hJIklg2v5NpTVGW0b4+TPXtdQPgYZpdjyvgA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0NXj+v5H; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0NXj+v5H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C9FD1F000E9; Tue, 25 Aug 2026 13:50:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787665830; bh=aI1kBnZFDIBRHUBuQFsANJtAB89CCA7GTXRuybU9E+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=0NXj+v5HRD+huZV/PV2fHQKtGl593HigDyVJr+S0mAsxYR2k1HUOqBhq2R7uW46fI MevriqIkoV7KFlqHSUpXxzf2aDGB8JDPW5ARuIAwNRsJz6x8B2juqMliB9IuGxzbz+ JhEaC0abmmenlvtSvjije6tAuyg+Yfl03BK2c/Xc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qing Luo , "Matthieu Baerts (NGI0)" , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 63/87] mptcp: pm: fix data race in add_addr timer callback Date: Tue, 25 Aug 2026 15:26:26 +0200 Message-ID: <20260825132544.296681545@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260825132541.813800447@linuxfoundation.org> References: <20260825132541.813800447@linuxfoundation.org> User-Agent: quilt/0.69 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.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Qing Luo [ Upstream commit a7aad5b69d3bdaec20a3ed9284e184502450c0cd ] The timer callback reads entry->retrans_times outside pm.lock to decide whether to call mptcp_pm_subflow_established(). Since mptcp_pm_announced_del_timer() can concurrently set retrans_times = ADD_ADDR_RETRANS_MAX under pm.lock, a race condition exists. I discovered this issue while studying the code. AI tools helped me to verify the issue can potentially happen under race conditions. Use a local 'retransmit' flag set inside pm.lock to capture whether retransmission is still possible when the lock is taken. This allows to call mptcp_pm_subflow_established() accordingly, and not depending on the situation that can be different when checked outside the pm.lock. Fixes: 348d5c1dec60 ("mptcp: move to next addr when timeout") Cc: stable@vger.kernel.org Signed-off-by: Qing Luo Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Link: https://patch.msgid.link/20260803-net-mptcp-misc-fixes-7-2-rc6-v2-4-b8f496d71664@kernel.org Signed-off-by: Jakub Kicinski [ applied to mptcp_pm_add_timer() in pm_netlink.c instead of pm.c and collapsed the adaptive backoff branch to `if (!retransmit) timeout = 0;` since the tree lacks exponential ADD_ADDR retransmission timeouts ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/mptcp/pm_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -297,6 +297,7 @@ static void mptcp_pm_add_timer(struct ti struct mptcp_sock *msk = entry->sock; struct sock *sk = (struct sock *)msk; unsigned int timeout = 0; + bool retransmit; pr_debug("msk=%p\n", msk); @@ -334,12 +335,13 @@ static void mptcp_pm_add_timer(struct ti entry->retrans_times++; } - if (entry->retrans_times >= ADD_ADDR_RETRANS_MAX) + retransmit = entry->retrans_times < ADD_ADDR_RETRANS_MAX; + if (!retransmit) timeout = 0; spin_unlock_bh(&msk->pm.lock); - if (entry->retrans_times == ADD_ADDR_RETRANS_MAX) + if (!retransmit) mptcp_pm_subflow_established(msk); out: