提交 e53da5fb 编写于 作者: D David S. Miller

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: NDavid S. Miller <davem@davemloft.net>
上级 dee49f20
......@@ -1718,6 +1718,8 @@ EXPORT_SYMBOL(sock_kmalloc);
*/
void sock_kfree_s(struct sock *sk, void *mem, int size)
{
if (WARN_ON_ONCE(!mem))
return;
kfree(mem);
atomic_sub(size, &sk->sk_omem_alloc);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册