From: Arnaldo Carvalho de Melo Date: Wed, 20 Apr 2005 05:41:54 +0000 (-0700) Subject: [SOCK]: on failure free the sock from the right place X-Git-Tag: daily-2014.03.25.0_l4t/l4t-r19.1~54148 X-Git-Url: https://nv-tegra.nvidia.com/r/gitweb?p=linux-3.10.git;a=commitdiff_plain;h=88a66858253c57334a519a77187234867bc8605c [SOCK]: on failure free the sock from the right place Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- diff --git a/net/core/sock.c b/net/core/sock.c index f52c87a9268..4df4fa3c5de 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -641,7 +641,10 @@ struct sock *sk_alloc(int family, int priority, struct proto *prot, int zero_it) } if (security_sk_alloc(sk, family, priority)) { - kmem_cache_free(slab, sk); + if (slab != NULL) + kmem_cache_free(slab, sk); + else + kfree(sk); sk = NULL; } else __module_get(prot->owner);