diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-03-16 18:19:12 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-16 16:25:06 -0400 |
commit | c243d7e20996254f89c28d4838b5feca735c030d (patch) | |
tree | 13ce4c9af9215945e69a86300039396bfb1f04cd /net | |
parent | db4374f48a6c31c02f6ad1d19b257c186b443c0c (diff) | |
download | op-kernel-dev-c243d7e20996254f89c28d4838b5feca735c030d.zip op-kernel-dev-c243d7e20996254f89c28d4838b5feca735c030d.tar.gz |
net: kernel socket should be released in init_net namespace
Creating a kernel socket with sock_create_kern() happens in "init_net"
namespace, however, releasing it with sk_release_kernel() occurs in
the current namespace which may be different with "init_net" namespace.
Therefore, we should guarantee that the namespace in which a kernel
socket is created is same as the socket is created.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index a950b54..d9f9e48 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1454,8 +1454,8 @@ void sk_release_kernel(struct sock *sk) return; sock_hold(sk); - sock_release(sk->sk_socket); sock_net_set(sk, get_net(&init_net)); + sock_release(sk->sk_socket); sock_put(sk); } EXPORT_SYMBOL(sk_release_kernel); |