aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/core/sock.c b/net/core/sock.c
index bbc726a49d87..a31455dc7024 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -873,7 +873,7 @@ static inline void sock_lock_init(struct sock *sk)
873 * @prot: struct proto associated with this new sock instance 873 * @prot: struct proto associated with this new sock instance
874 * @zero_it: if we should zero the newly allocated sock 874 * @zero_it: if we should zero the newly allocated sock
875 */ 875 */
876struct sock *sk_alloc(int family, gfp_t priority, 876struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
877 struct proto *prot, int zero_it) 877 struct proto *prot, int zero_it)
878{ 878{
879 struct sock *sk = NULL; 879 struct sock *sk = NULL;
@@ -894,6 +894,7 @@ struct sock *sk_alloc(int family, gfp_t priority,
894 */ 894 */
895 sk->sk_prot = sk->sk_prot_creator = prot; 895 sk->sk_prot = sk->sk_prot_creator = prot;
896 sock_lock_init(sk); 896 sock_lock_init(sk);
897 sk->sk_net = get_net(net);
897 } 898 }
898 899
899 if (security_sk_alloc(sk, family, priority)) 900 if (security_sk_alloc(sk, family, priority))
@@ -933,6 +934,7 @@ void sk_free(struct sock *sk)
933 __FUNCTION__, atomic_read(&sk->sk_omem_alloc)); 934 __FUNCTION__, atomic_read(&sk->sk_omem_alloc));
934 935
935 security_sk_free(sk); 936 security_sk_free(sk);
937 put_net(sk->sk_net);
936 if (sk->sk_prot_creator->slab != NULL) 938 if (sk->sk_prot_creator->slab != NULL)
937 kmem_cache_free(sk->sk_prot_creator->slab, sk); 939 kmem_cache_free(sk->sk_prot_creator->slab, sk);
938 else 940 else
@@ -942,7 +944,7 @@ void sk_free(struct sock *sk)
942 944
943struct sock *sk_clone(const struct sock *sk, const gfp_t priority) 945struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
944{ 946{
945 struct sock *newsk = sk_alloc(sk->sk_family, priority, sk->sk_prot, 0); 947 struct sock *newsk = sk_alloc(sk->sk_net, sk->sk_family, priority, sk->sk_prot, 0);
946 948
947 if (newsk != NULL) { 949 if (newsk != NULL) {
948 struct sk_filter *filter; 950 struct sk_filter *filter;