diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h index cf8f792743ec2a6e7055891308b6ca94c7b0ad08..c76a5e9894dacc81d64950ab6af1ab6267cc31f4 100644 --- a/include/net/busy_poll.h +++ b/include/net/busy_poll.h @@ -48,7 +48,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 cb27f9cc7ab99100a6d9302984e7bfa43ceaf8a3..a0c1d8531e86ee00530d6555cb130b2a018d2fd4 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1011,7 +1011,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; #endif