Skip to content

Commit

Permalink
[NETNS]: Add netns refcnt debug for kernel sockets.
Browse files Browse the repository at this point in the history
Protocol control sockets and netlink kernel sockets should not prevent the
namespace stop request. They are initialized and disposed in a special way by
sk_change_net/sk_release_kernel.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Apr 16, 2008
1 parent 5d1e446 commit 65a18ec
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ void sock_net_set(struct sock *sk, struct net *net)
static inline void sk_change_net(struct sock *sk, struct net *net)
{
put_net(sock_net(sk));
sock_net_set(sk, net);
sock_net_set(sk, hold_net(net));
}

extern void sock_enable_timestamp(struct sock *sk);
Expand Down
1 change: 1 addition & 0 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -1001,6 +1001,7 @@ void sk_release_kernel(struct sock *sk)

sock_hold(sk);
sock_release(sk->sk_socket);
release_net(sock_net(sk));
sock_net_set(sk, get_net(&init_net));
sock_put(sk);
}
Expand Down

0 comments on commit 65a18ec

Please sign in to comment.