diff options
author | Eric Dumazet <edumazet@google.com> | 2023-07-19 23:28:55 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-07-20 21:34:18 +0200 |
commit | 1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b (patch) | |
tree | da6989426c0f6a60fc3af24da6df5ebb71cd4ae1 /net/ipv4 | |
parent | tcp: annotate data-races around rskq_defer_accept (diff) | |
download | linux-1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b.tar.xz linux-1aeb87bc1440c5447a7fa2d6e3c2cca52cbd206b.zip |
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 'net/ipv4')
-rw-r--r-- | net/ipv4/tcp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 5beec71a5c41..2b2241e9b492 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -3664,7 +3664,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname, err = tcp_repair_set_window(tp, optval, optlen); break; case TCP_NOTSENT_LOWAT: - tp->notsent_lowat = val; + WRITE_ONCE(tp->notsent_lowat, val); sk->sk_write_space(sk); break; case TCP_INQ: @@ -4164,7 +4164,7 @@ int do_tcp_getsockopt(struct sock *sk, int level, val = tcp_time_stamp_raw() + READ_ONCE(tp->tsoffset); break; case TCP_NOTSENT_LOWAT: - val = tp->notsent_lowat; + val = READ_ONCE(tp->notsent_lowat); break; case TCP_INQ: val = tp->recvmsg_inq; |