summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2025-06-20 18:55:35 +0300
committerJakub Kicinski <kuba@kernel.org>2025-06-24 03:05:11 +0300
commit3169e36ae14802b01abe4bfa7ec593b0a1af5cc7 (patch)
treecf5e5c786662af907bf4cfef42b736493a00fe6b /include
parent0fd9e5958ebb41188700b566467a1d9a3ebcdece (diff)
downloadlinux-3169e36ae14802b01abe4bfa7ec593b0a1af5cc7.tar.xz
net: make sk->sk_sndtimeo lockless
Followup of commit 285975dd6742 ("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>
Diffstat (limited to 'include')
-rw-r--r--include/net/sock.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index bbd97fbc5935..b08e36bf9669 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -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)