summaryrefslogtreecommitdiff
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2025-06-20 15:55:36 +0000
committerJakub Kicinski <kuba@kernel.org>2025-06-23 17:05:12 -0700
commit935b67675a9f233aa4ac4ae6452b2cc45418d839 (patch)
treee20347e07374de053e0dac18a6d49364a8823660 /include/net/sock.h
parent3169e36ae14802b01abe4bfa7ec593b0a1af5cc7 (diff)
net: make sk->sk_rcvtimeo lockless
Followup of commit 285975dd6742 ("net: annotate data-races around sk->sk_{rcv|snd}timeo"). Remove lock_sock()/release_sock() from ksmbd_tcp_rcv_timeout() and add READ_ONCE()/WRITE_ONCE() where it is needed. Also SO_RCVTIMEO_OLD and SO_RCVTIMEO_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-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/sock.h')
-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 b08e36bf9669..0f2443d4ec58 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2596,7 +2596,7 @@ static inline gfp_t gfp_memcg_charge(void)
static inline long sock_rcvtimeo(const struct sock *sk, bool noblock)
{
- return noblock ? 0 : sk->sk_rcvtimeo;
+ return noblock ? 0 : READ_ONCE(sk->sk_rcvtimeo);
}
static inline long sock_sndtimeo(const struct sock *sk, bool noblock)