aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-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 f52c87a..4df4fa3 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);