aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sock.h2
-rw-r--r--net/core/sock.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 09255eae93e9..dc42b44c2aa1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1314,7 +1314,7 @@ void sock_net_set(struct sock *sk, struct net *net)
1314static inline void sk_change_net(struct sock *sk, struct net *net) 1314static inline void sk_change_net(struct sock *sk, struct net *net)
1315{ 1315{
1316 put_net(sock_net(sk)); 1316 put_net(sock_net(sk));
1317 sock_net_set(sk, net); 1317 sock_net_set(sk, hold_net(net));
1318} 1318}
1319 1319
1320extern void sock_enable_timestamp(struct sock *sk); 1320extern void sock_enable_timestamp(struct sock *sk);
diff --git a/net/core/sock.c b/net/core/sock.c
index c0ecbdcf75d8..54c836a2216b 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1001,6 +1001,7 @@ void sk_release_kernel(struct sock *sk)
1001 1001
1002 sock_hold(sk); 1002 sock_hold(sk);
1003 sock_release(sk->sk_socket); 1003 sock_release(sk->sk_socket);
1004 release_net(sock_net(sk));
1004 sock_net_set(sk, get_net(&init_net)); 1005 sock_net_set(sk, get_net(&init_net));
1005 sock_put(sk); 1006 sock_put(sk);
1006} 1007}