diff --git a/include/net/sock.h b/include/net/sock.h index 52448baf19d7069c93770c21f0deb476d8f4b6a6..2fdb87f176cf57b853b2e2ebe197d3f47c9c9cf1 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1409,7 +1409,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow) static inline bool sock_owned_by_user(const struct sock *sk) { #ifdef CONFIG_LOCKDEP - WARN_ON(!lockdep_sock_is_held(sk)); + WARN_ON_ONCE(!lockdep_sock_is_held(sk) && debug_locks); #endif return sk->sk_lock.owned; }