tcp_metrics: annotate data-races around tm->tcpm_net
authorEric Dumazet <edumazet@google.com>
Wed, 2 Aug 2023 13:14:59 +0000 (13:14 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 3 Aug 2023 17:58:24 +0000 (10:58 -0700)
commitd5d986ce42c71a7562d32c4e21e026b0f87befec
tree9b4b6d9d2684efe9d5298e8b18d2958ca83d8613
parent8c4d04f6b443869d25e59822f7cec88d647028a9
tcp_metrics: annotate data-races around tm->tcpm_net

tm->tcpm_net can be read or written locklessly.

Instead of changing write_pnet() and read_pnet() and potentially
hurt performance, add the needed READ_ONCE()/WRITE_ONCE()
in tm_net() and tcpm_new().

Fixes: 849e8a0ca8d5 ("tcp_metrics: Add a field tcpm_net and verify it matches on lookup")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/r/20230802131500.1478140-6-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_metrics.c