From: linke li <lilinke99@qq.com>
Cc: lilinke99@qq.com, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Kuniyuki Iwashima <kuniyu@amazon.com>,
Willem de Bruijn <willemb@google.com>,
Abel Wu <wuyun.abel@bytedance.com>,
Breno Leitao <leitao@debian.org>,
Alexander Mikhalitsyn <alexander@mihalicyn.com>,
David Howells <dhowells@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: mark racy access on sk->sk_rcvbuf
Date: Sat, 9 Mar 2024 21:34:40 +0800 [thread overview]
Message-ID: <tencent_DC4901C65DB41D86CD613F3ACC41EA143808@qq.com> (raw)
sk->sk_rcvbuf can be changed by other threads. Mark this as benign using
READ_ONCE.
This patch is aimed at reducing the number of benign races reported by
KCSAN in order to focus future debugging effort on harmful races.
Signed-off-by: linke li <lilinke99@qq.com>
---
net/core/sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 5e78798456fd..4c5524e70534 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -551,7 +551,7 @@ int __sk_receive_skb(struct sock *sk, struct sk_buff *skb,
skb->dev = NULL;
- if (sk_rcvqueues_full(sk, sk->sk_rcvbuf)) {
+ if (sk_rcvqueues_full(sk, READ_ONCE(sk->sk_rcvbuf))) {
atomic_inc(&sk->sk_drops);
goto discard_and_relse;
}
--
2.39.3 (Apple Git-146)
next reply other threads:[~2024-03-09 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-09 13:34 linke li [this message]
2024-03-09 13:50 ` [PATCH] net: mark racy access on sk->sk_rcvbuf Eric Dumazet
2024-03-09 13:59 ` linke li
2024-03-09 14:49 ` Jason Xing
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=tencent_DC4901C65DB41D86CD613F3ACC41EA143808@qq.com \
--to=lilinke99@qq.com \
--cc=alexander@mihalicyn.com \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
--cc=wuyun.abel@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox