diff options
author | Eric Dumazet <edumazet@google.com> | 2023-07-19 21:28:55 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-11 11:33:49 +0200 |
commit | 4793f9802741a5448b5a0a36b4d1d2f0eda97923 (patch) | |
tree | f2692be0b8cf55873ec7938e18c6040e12f7b8c8 /include | |
parent | c7f9077fa213a1d1425d1be3ac9544289c30ec97 (diff) | |
download | linux-stable-4793f9802741a5448b5a0a36b4d1d2f0eda97923.tar.gz linux-stable-4793f9802741a5448b5a0a36b4d1d2f0eda97923.tar.bz2 linux-stable-4793f9802741a5448b5a0a36b4d1d2f0eda97923.zip |
tcp: annotate data-races around tp->notsent_lowat
[ Upstream commit 1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/tcp.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 4f97c0e2d5f3..b1a9e6b1a153 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1887,7 +1887,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); } static inline bool tcp_stream_memory_free(const struct sock *sk) |