* [PATCH net-next] net: kernel socket should be released in init_net namespace
@ 2015-03-16 10:19 Ying Xue
2015-03-16 20:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ying Xue @ 2015-03-16 10:19 UTC (permalink / raw)
To: netdev; +Cc: davem, edumazet, ebiederm
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>
---
net/core/sock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/sock.c b/net/core/sock.c
index 4bc42ef..11e144e 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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net: kernel socket should be released in init_net namespace
2015-03-16 10:19 [PATCH net-next] net: kernel socket should be released in init_net namespace Ying Xue
@ 2015-03-16 20:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-03-16 20:25 UTC (permalink / raw)
To: ying.xue; +Cc: netdev, edumazet, ebiederm
From: Ying Xue <ying.xue@windriver.com>
Date: Mon, 16 Mar 2015 18:19:12 +0800
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-16 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-16 10:19 [PATCH net-next] net: kernel socket should be released in init_net namespace Ying Xue
2015-03-16 20:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).