mirror of
https://github.com/torvalds/linux.git
synced 2026-05-05 23:05:25 -04:00
net: make sk->sk_sndtimeo lockless
Followup of commit 285975dd67 ("net: annotate data-races around
sk->sk_{rcv|snd}timeo").
Remove lock_sock()/release_sock() from sock_set_sndtimeo(),
and add READ_ONCE()/WRITE_ONCE() where it is needed.
Also SO_SNDTIMEO_OLD and SO_SNDTIMEO_NEW can call sock_set_timeout()
without holding the socket lock.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250620155536.335520-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
0fd9e5958e
commit
3169e36ae1
@@ -2601,7 +2601,7 @@ static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
|
||||
|
||||
static inline long sock_sndtimeo(const struct sock *sk, bool noblock)
|
||||
{
|
||||
return noblock ? 0 : sk->sk_sndtimeo;
|
||||
return noblock ? 0 : READ_ONCE(sk->sk_sndtimeo);
|
||||
}
|
||||
|
||||
static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len)
|
||||
|
||||
Reference in New Issue
Block a user