mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 17:43:52 +02:00
tcp: annotate data-races around tp->bytes_sent
tcp_get_timestamping_opt_stats() intentionally runs lockless, we must
add READ_ONCE() and WRITE_ONCE() annotations to keep KCSAN happy.
Fixes: ba113c3aa7 ("tcp: add data bytes sent stats")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260416200319.3608680-8-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
124199444d
commit
ee43e957ce
|
|
@ -4461,7 +4461,7 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk,
|
|||
READ_ONCE(tp->write_seq) - READ_ONCE(tp->snd_una)));
|
||||
nla_put_u8(stats, TCP_NLA_CA_STATE, inet_csk(sk)->icsk_ca_state);
|
||||
|
||||
nla_put_u64_64bit(stats, TCP_NLA_BYTES_SENT, tp->bytes_sent,
|
||||
nla_put_u64_64bit(stats, TCP_NLA_BYTES_SENT, READ_ONCE(tp->bytes_sent),
|
||||
TCP_NLA_PAD);
|
||||
nla_put_u64_64bit(stats, TCP_NLA_BYTES_RETRANS, tp->bytes_retrans,
|
||||
TCP_NLA_PAD);
|
||||
|
|
|
|||
|
|
@ -1690,7 +1690,8 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
|
|||
tcp_event_data_sent(tp, sk);
|
||||
WRITE_ONCE(tp->data_segs_out,
|
||||
tp->data_segs_out + tcp_skb_pcount(skb));
|
||||
tp->bytes_sent += skb->len - tcp_header_size;
|
||||
WRITE_ONCE(tp->bytes_sent,
|
||||
tp->bytes_sent + skb->len - tcp_header_size);
|
||||
}
|
||||
|
||||
if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user