aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/core/sock.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index 4f4708a6ff8f..6046fc69428b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -931,21 +931,16 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
931{ 931{
932 struct sock *sk; 932 struct sock *sk;
933 933
934 if (zero_it) 934 sk = sk_prot_alloc(prot, priority | __GFP_ZERO, family);
935 priority |= __GFP_ZERO;
936
937 sk = sk_prot_alloc(prot, priority, family);
938 if (sk) { 935 if (sk) {
939 if (zero_it) { 936 sk->sk_family = family;
940 sk->sk_family = family; 937 /*
941 /* 938 * See comment in struct sock definition to understand
942 * See comment in struct sock definition to understand 939 * why we need sk_prot_creator -acme
943 * why we need sk_prot_creator -acme 940 */
944 */ 941 sk->sk_prot = sk->sk_prot_creator = prot;
945 sk->sk_prot = sk->sk_prot_creator = prot; 942 sock_lock_init(sk);
946 sock_lock_init(sk); 943 sk->sk_net = get_net(net);
947 sk->sk_net = get_net(net);
948 }
949 } 944 }
950 945
951 return sk; 946 return sk;