Skip to content

Commit f597c36

Browse files
edumazetgregkh
authored andcommitted
tcp: annotate data-races around (tp->write_seq - tp->snd_nxt)
[ Upstream commit 3a63b3d ] tcp_get_timestamping_opt_stats() intentionally runs lockless, we must add READ_ONCE() annotations to keep KCSAN happy. WRITE_ONCE() annotations are already present. Fixes: e08ab0b ("tcp: add bytes not sent to SCM_TIMESTAMPING_OPT_STATS") Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20260416200319.3608680-14-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c6e108c commit f597c36

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

net/ipv4/tcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4311,7 +4311,8 @@ struct sk_buff *tcp_get_timestamping_opt_stats(const struct sock *sk,
43114311
nla_put_u32(stats, TCP_NLA_SRTT, tp->srtt_us >> 3);
43124312
nla_put_u16(stats, TCP_NLA_TIMEOUT_REHASH, tp->timeout_rehash);
43134313
nla_put_u32(stats, TCP_NLA_BYTES_NOTSENT,
4314-
max_t(int, 0, tp->write_seq - tp->snd_nxt));
4314+
max_t(int, 0,
4315+
READ_ONCE(tp->write_seq) - READ_ONCE(tp->snd_nxt)));
43154316
nla_put_u64_64bit(stats, TCP_NLA_EDT, orig_skb->skb_mstamp_ns,
43164317
TCP_NLA_PAD);
43174318
if (ack_skb)

0 commit comments

Comments
 (0)