Skip to content

Commit

Permalink
[SOCK]: on failure free the sock from the right place
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Arnaldo Carvalho de Melo authored and David S. Miller committed Apr 20, 2005
1 parent 9c2b332 commit 88a6685
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 88a6685

Please sign in to comment.