From: Eric Dumazet Date: Mon, 25 Apr 2016 13:34:09 +0000 (-0700) Subject: sock: relax WARN_ON() in sock_owned_by_user() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5e91f6ce4c584d231763437a3ea3aded8e672363;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git sock: relax WARN_ON() in sock_owned_by_user() Valdis reported tons of stack dumps caused by WARN_ON() in sock_owned_by_user() This test needs to be relaxed if/when lockdep disables itself. Note that other lockdep_sock_is_held() callers are all from rcu_dereference_protected() sections which already are disabled if/when lockdep has been disabled. Fixes: fafc4e1ea1a4 ("sock: tigthen lockdep checks for sock_owned_by_user") Reported-by: Valdis Kletnieks Signed-off-by: Eric Dumazet Acked-by: Hannes Frederic Sowa Signed-off-by: David S. Miller --- diff --git a/include/net/sock.h b/include/net/sock.h index 52448baf19d7..2fdb87f176cf 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; }