Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: use WARN_ON_ONCE() in inet_sock_destruct()

inet_sock_destruct() has four warnings which have been
useful to point to kernel bugs in the past.

However they are potentially a problem because they
could flood the syslog.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
3e7f2b8d 76458fae

+4 -4
+4 -4
net/ipv4/af_inet.c
··· 148 148 return; 149 149 } 150 150 151 - WARN_ON(atomic_read(&sk->sk_rmem_alloc)); 152 - WARN_ON(refcount_read(&sk->sk_wmem_alloc)); 153 - WARN_ON(sk->sk_wmem_queued); 154 - WARN_ON(sk_forward_alloc_get(sk)); 151 + WARN_ON_ONCE(atomic_read(&sk->sk_rmem_alloc)); 152 + WARN_ON_ONCE(refcount_read(&sk->sk_wmem_alloc)); 153 + WARN_ON_ONCE(sk->sk_wmem_queued); 154 + WARN_ON_ONCE(sk_forward_alloc_get(sk)); 155 155 156 156 kfree(rcu_dereference_protected(inet->inet_opt, 1)); 157 157 dst_release(rcu_dereference_protected(sk->sk_dst_cache, 1));