summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2023-07-20 00:28:55 +0300
committerJakub Kicinski <kuba@kernel.org>2023-07-20 22:34:18 +0300
commit1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b (patch)
treeda6989426c0f6a60fc3af24da6df5ebb71cd4ae1 /include
parentae488c74422fb1dcd807c0201804b3b5e8a322a3 (diff)
downloadlinux-1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b.tar.xz
tcp: annotate data-races around tp->notsent_lowat
tp->notsent_lowat can be read locklessly from do_tcp_getsockopt() and tcp_poll(). Fixes: c9bee3b7fdec ("tcp: TCP_NOTSENT_LOWAT socket option") Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://lore.kernel.org/r/20230719212857.3943972-10-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/tcp.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a8b93b2875ea..0ca972ebd3dd 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -2061,7 +2061,11 @@ void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
{
struct net *net = sock_net((struct sock *)tp);
- return tp->notsent_lowat ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);
+ u32 val;
+
+ val = READ_ONCE(tp->notsent_lowat);
+
+ return val ?: READ_ONCE(net->ipv4.sysctl_tcp_notsent_lowat);
}
bool tcp_stream_memory_free(const struct sock *sk, int wake);