提交 c243d7e2 编写于 作者: Y Ying Xue 提交者: David S. Miller

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: NYing Xue <ying.xue@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 db4374f4
...@@ -1454,8 +1454,8 @@ void sk_release_kernel(struct sock *sk) ...@@ -1454,8 +1454,8 @@ void sk_release_kernel(struct sock *sk)
return; return;
sock_hold(sk); sock_hold(sk);
sock_release(sk->sk_socket);
sock_net_set(sk, get_net(&init_net)); sock_net_set(sk, get_net(&init_net));
sock_release(sk->sk_socket);
sock_put(sk); sock_put(sk);
} }
EXPORT_SYMBOL(sk_release_kernel); EXPORT_SYMBOL(sk_release_kernel);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册