aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index f52c87a9268a..4df4fa3c5de0 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)
641 } 641 }
642 642
643 if (security_sk_alloc(sk, family, priority)) { 643 if (security_sk_alloc(sk, family, priority)) {
644 kmem_cache_free(slab, sk); 644 if (slab != NULL)
645 kmem_cache_free(slab, sk);
646 else
647 kfree(sk);
645 sk = NULL; 648 sk = NULL;
646 } else 649 } else
647 __module_get(prot->owner); 650 __module_get(prot->owner);