Message ID | 20210629141245.1278533-1-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0dbffbb5335a1e3aa6855e4ee317e25e669dd302 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net] net: annotate data race around sk_ll_usec | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | fail | Series targets non-next tree, but doesn't contain any Fixes tags |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 7 maintainers not CCed: linmiaohe@huawei.com xiangxia.m.yue@gmail.com keescook@chromium.org bjorn@kernel.org pabeni@redhat.com aahringo@redhat.com mathew.j.martineau@linux.intel.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 85 this patch: 85 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | warning | WARNING: Possible repeated word: 'Google' |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 85 this patch: 85 |
netdev/header_inline | success | Link |
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Tue, 29 Jun 2021 07:12:45 -0700 you wrote: > From: Eric Dumazet <edumazet@google.com> > > sk_ll_usec is read locklessly from sk_can_busy_loop() > while another thread can change its value in sock_setsockopt() > > This is correct but needs annotations. > > [...] Here is the summary with links: - [net] net: annotate data race around sk_ll_usec https://git.kernel.org/netdev/net/c/0dbffbb5335a You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index 73af4a64a5999660127dab0a4d111e50eeadf1b5..40296ed976a9778ceb239b99ad783cb99b8b92ef 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h @@ -38,7 +38,7 @@ static inline bool net_busy_loop_on(void) static inline bool sk_can_busy_loop(const struct sock *sk) { - return sk->sk_ll_usec && !signal_pending(current); + return READ_ONCE(sk->sk_ll_usec) && !signal_pending(current); } bool sk_busy_loop_end(void *p, unsigned long start_time); diff --git a/net/core/sock.c b/net/core/sock.c index 946888afef880342cc08940e6bad1f295a985dd8..d27fdc2adf9c953fab3e25368150fb1412c7b249 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1172,7 +1172,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname, if (val < 0) ret = -EINVAL; else - sk->sk_ll_usec = val; + WRITE_ONCE(sk->sk_ll_usec, val); } break; case SO_PREFER_BUSY_POLL: