mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
tcp: annotate data-races around icsk->icsk_user_timeout
This field can be read locklessly from do_tcp_getsockopt()
Fixes: dca43c75e7
("tcp: Add TCP_USER_TIMEOUT socket option.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20230719212857.3943972-11-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1aeb87bc14
commit
26023e91e1
@ -3300,7 +3300,7 @@ EXPORT_SYMBOL(tcp_sock_set_syncnt);
|
||||
void tcp_sock_set_user_timeout(struct sock *sk, u32 val)
|
||||
{
|
||||
lock_sock(sk);
|
||||
inet_csk(sk)->icsk_user_timeout = val;
|
||||
WRITE_ONCE(inet_csk(sk)->icsk_user_timeout, val);
|
||||
release_sock(sk);
|
||||
}
|
||||
EXPORT_SYMBOL(tcp_sock_set_user_timeout);
|
||||
@ -3620,7 +3620,7 @@ int do_tcp_setsockopt(struct sock *sk, int level, int optname,
|
||||
if (val < 0)
|
||||
err = -EINVAL;
|
||||
else
|
||||
icsk->icsk_user_timeout = val;
|
||||
WRITE_ONCE(icsk->icsk_user_timeout, val);
|
||||
break;
|
||||
|
||||
case TCP_FASTOPEN:
|
||||
@ -4141,7 +4141,7 @@ int do_tcp_getsockopt(struct sock *sk, int level,
|
||||
break;
|
||||
|
||||
case TCP_USER_TIMEOUT:
|
||||
val = icsk->icsk_user_timeout;
|
||||
val = READ_ONCE(icsk->icsk_user_timeout);
|
||||
break;
|
||||
|
||||
case TCP_FASTOPEN:
|
||||
|
Loading…
Reference in New Issue
Block a user