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 96EB0347515; Wed, 20 May 2026 18:19:35 +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=1779301176; cv=none; b=tPPKAFpkaslKZ1QsjrBpL+WewHlQuIMvi6ELdzEoZuvgQicgeCxmvXiIDU+pICOozpPDodTB2EhuqhknULVkOm4CrLDuEwDtZcvWibCBjF1TFrHfZM/0wAYbqS26xrLhBibMShWwNZCXQQWxkOXHWXHslnfR/SMvdpkUG7xmuQg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779301176; c=relaxed/simple; bh=CMBJauG9NVSCC633AgoPKA3/umWaWCDWFSG+B16637M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kZgxK1ocwEkjFDIC2zb9MoYfnu9qp8qsYpZE7Er1Lwj9Hx3qY8S2Yo5zPifCYM0ktkB9yOdIg7eircIfC3+Ht3vUcogg5boA6lShnHuePzInxWTxlmgBeds2aovq6ZpMJ7DL/9CDElijvIVjX/3Kbl+a+mkBpR/XL6uE9ug4FeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YrN115O9; 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="YrN115O9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08BCF1F000E9; Wed, 20 May 2026 18:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1779301175; bh=r3wdiCftqXtLZZdutk/Rl/p1YQNBAhWDpbXdVfhHeao=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YrN115O9gtHEwC/CHFdCnLFeozkoxcnzrLmmeRusc2P5chhwvFYfp2OvIpJuqmK/P PcX+/hy0Y8KsKkS8LxT3FNz3B89y9HRXaKyq+Svgr5IcCzlDXchJP7qtkli7mXVETt j91QR6SnRKLo1ZBOT7JuKhMe8SD0DD6R8pRWaFK8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 455/666] tcp: annotate data-races around tp->plb_rehash Date: Wed, 20 May 2026 18:21:06 +0200 Message-ID: <20260520162121.133479978@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520162111.222830634@linuxfoundation.org> References: <20260520162111.222830634@linuxfoundation.org> User-Agent: quilt/0.69 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: Eric Dumazet [ Upstream commit 9e89b9d03a2d2e30dcca166d5af52f9a8eceab25 ] tcp_get_timestamping_opt_stats() intentionally runs lockless, we must add READ_ONCE() and WRITE_ONCE() annotations to keep KCSAN happy. Fixes: 29c1c44646ae ("tcp: add u32 counter in tcp_sock and an SNMP counter for PLB") Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260416200319.3608680-15-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/tcp.c | 3 ++- net/ipv4/tcp_plb.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 45e093ca22533..8b90665245b2d 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -4319,7 +4319,8 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk, nla_put_u8(stats, TCP_NLA_TTL, tcp_skb_ttl_or_hop_limit(ack_skb)); - nla_put_u32(stats, TCP_NLA_REHASH, tp->plb_rehash + tp->timeout_rehash); + nla_put_u32(stats, TCP_NLA_REHASH, + READ_ONCE(tp->plb_rehash) + READ_ONCE(tp->timeout_rehash)); return stats; } diff --git a/net/ipv4/tcp_plb.c b/net/ipv4/tcp_plb.c index 4bcf7eff95e39..b7f9b60d8991f 100644 --- a/net/ipv4/tcp_plb.c +++ b/net/ipv4/tcp_plb.c @@ -79,7 +79,7 @@ void tcp_plb_check_rehash(struct sock *sk, struct tcp_plb_state *plb) sk_rethink_txhash(sk); plb->consec_cong_rounds = 0; - tcp_sk(sk)->plb_rehash++; + WRITE_ONCE(tcp_sk(sk)->plb_rehash, tcp_sk(sk)->plb_rehash + 1); NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPPLBREHASH); } EXPORT_SYMBOL_GPL(tcp_plb_check_rehash); -- 2.53.0