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

net: Trap attempts to call sock_kfree_s() with a NULL pointer.

Unlike normal kfree() it is never right to call sock_kfree_s() with
a NULL pointer, because sock_kfree_s() also has the side effect of
discharging the memory from the sockets quota.

Signed-off-by: David S. Miller <davem@davemloft.net>

+2
+2
net/core/sock.c
··· 1718 1718 */ 1719 1719 void sock_kfree_s(struct sock *sk, void *mem, int size) 1720 1720 { 1721 + if (WARN_ON_ONCE(!mem)) 1722 + return; 1721 1723 kfree(mem); 1722 1724 atomic_sub(size, &sk->sk_omem_alloc); 1723 1725 }