[SOCK]: on failure free the sock from the right place
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>
Wed, 20 Apr 2005 05:41:54 +0000 (22:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Apr 2005 05:41:54 +0000 (22:41 -0700)
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock.c

index f52c87a9268a772398e937a80730d576ab32a066..4df4fa3c5de047e3ee099b64b38c4948b2dd406a 100644 (file)
@@ -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);