summaryrefslogtreecommitdiff
path: root/net/smc
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2025-06-20 15:55:35 +0000
committerJakub Kicinski <kuba@kernel.org>2025-06-23 17:05:11 -0700
commit3169e36ae14802b01abe4bfa7ec593b0a1af5cc7 (patch)
treecf5e5c786662af907bf4cfef42b736493a00fe6b /net/smc
parent0fd9e5958ebb41188700b566467a1d9a3ebcdece (diff)
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 'net/smc')
-rw-r--r--net/smc/af_smc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 3760131f1484..6375a86fe2b5 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -486,7 +486,7 @@ static void smc_copy_sock_settings(struct sock *nsk, struct sock *osk,
{
/* options we don't get control via setsockopt for */
nsk->sk_type = osk->sk_type;
- nsk->sk_sndtimeo = osk->sk_sndtimeo;
+ nsk->sk_sndtimeo = READ_ONCE(osk->sk_sndtimeo);
nsk->sk_rcvtimeo = osk->sk_rcvtimeo;
nsk->sk_mark = READ_ONCE(osk->sk_mark);
nsk->sk_priority = READ_ONCE(osk->sk_priority);
@@ -1585,7 +1585,7 @@ static void smc_connect_work(struct work_struct *work)
{
struct smc_sock *smc = container_of(work, struct smc_sock,
connect_work);
- long timeo = smc->sk.sk_sndtimeo;
+ long timeo = READ_ONCE(smc->sk.sk_sndtimeo);
int rc = 0;
if (!timeo)