[SOCK]: on failure free the sock from the right place
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9c2b3328f7
commit
88a6685825
1 changed files with 4 additions and 1 deletions
|
|
@ -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)) {
|
if (security_sk_alloc(sk, family, priority)) {
|
||||||
|
if (slab != NULL)
|
||||||
kmem_cache_free(slab, sk);
|
kmem_cache_free(slab, sk);
|
||||||
|
else
|
||||||
|
kfree(sk);
|
||||||
sk = NULL;
|
sk = NULL;
|
||||||
} else
|
} else
|
||||||
__module_get(prot->owner);
|
__module_get(prot->owner);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue