From: Jason Xing <kerneljasonxing@gmail.com>
To: edumazet@google.com, dsahern@kernel.org, matttbe@kernel.org,
martineau@kernel.org, geliang@kernel.org, kuba@kernel.org,
pabeni@redhat.com, davem@davemloft.net
Cc: mptcp@lists.linux.dev, netdev@vger.kernel.org,
kerneljasonxing@gmail.com, Jason Xing <kernelxing@tencent.com>
Subject: [PATCH net-next 1/2] mptcp: annotate a data-race around sysctl_tcp_wmem[0]
Date: Fri, 8 Mar 2024 19:25:03 +0800 [thread overview]
Message-ID: <20240308112504.29099-2-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20240308112504.29099-1-kerneljasonxing@gmail.com>
From: Jason Xing <kernelxing@tencent.com>
It's possible that writer and the reader can manipulate the same
sysctl knob concurrently. Using READ_ONCE() to prevent reading
an old value.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
net/mptcp/protocol.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index f16edef6026a..a10ebf3ee10a 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -850,7 +850,7 @@ static inline void __mptcp_sync_sndbuf(struct sock *sk)
if (sk->sk_userlocks & SOCK_SNDBUF_LOCK)
return;
- new_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[0];
+ new_sndbuf = READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_wmem[0]);
mptcp_for_each_subflow(mptcp_sk(sk), subflow) {
ssk_sndbuf = READ_ONCE(mptcp_subflow_tcp_sock(subflow)->sk_sndbuf);
--
2.37.3
next prev parent reply other threads:[~2024-03-08 11:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-08 11:25 [PATCH net-next 0/2] annotate data-races around sysctl_tcp_wmem[0] Jason Xing
2024-03-08 11:25 ` Jason Xing [this message]
2024-03-08 12:54 ` [PATCH net-next 1/2] mptcp: annotate a data-race " Eric Dumazet
2024-03-08 20:26 ` Mat Martineau
2024-03-08 11:25 ` [PATCH net-next 2/2] tcp: " Jason Xing
2024-03-08 12:21 ` tcp: annotate a data-race around sysctl_tcp_wmem[0]: Tests Results MPTCP CI
2024-03-08 12:51 ` [PATCH net-next 2/2] tcp: annotate a data-race around sysctl_tcp_wmem[0] Eric Dumazet
2024-03-08 13:45 ` tcp: annotate a data-race around sysctl_tcp_wmem[0]: Tests Results MPTCP CI
2024-03-11 19:39 ` [PATCH net-next 0/2] annotate data-races around sysctl_tcp_wmem[0] patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240308112504.29099-2-kerneljasonxing@gmail.com \
--to=kerneljasonxing@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=geliang@kernel.org \
--cc=kernelxing@tencent.com \
--cc=kuba@kernel.org \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.