mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 00:51:51 -04:00
tcp: annotate data-races around tp->plb_rehash
tcp_get_timestamping_opt_stats() intentionally runs lockless, we must
add READ_ONCE() and WRITE_ONCE() annotations to keep KCSAN happy.
Fixes: 29c1c44646 ("tcp: add u32 counter in tcp_sock and an SNMP counter for PLB")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260416200319.3608680-15-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
3a63b3d160
commit
9e89b9d03a
@@ -4480,7 +4480,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,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);
|
||||
|
||||
Reference in New Issue
Block a user