[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874mnm1ove.fsf_-_@x220.int.ebiederm.org>
Date: Fri, 08 May 2015 21:11:33 -0500
From: ebiederm@...ssion.com (Eric W. Biederman)
To: davem@...emloft.net
Cc: Ying Xue <ying.xue@...driver.com>, netdev@...r.kernel.org,
cwang@...pensource.com, xemul@...nvz.org, eric.dumazet@...il.com,
maxk@....qualcomm.com, stephen@...workplumber.org, tgraf@...g.ch,
nicolas.dichtel@...nd.com, tom@...bertland.com,
jchapman@...alix.com, erik.hugne@...csson.com,
jon.maloy@...csson.com, horms@...ge.net.au,
Herbert Xu <herbert@...dor.apana.org.au>
Subject: [PATCH 5/6] netlink: Create kernel netlink sockets in the proper network namespace
Utilize the new functionality of sk_alloc so that nothing needs to be
done to suprress the reference counting on kernel sockets.
Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
---
net/netlink/af_netlink.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index d0a82b412b24..5e3883bad65a 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2473,16 +2473,11 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module,
if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock))
return NULL;
- /*
- * We have to just have a reference on the net from sk, but don't
- * get_net it. Besides, we cannot get and then put the net here.
- * So we create one inside init_net and the move it to net.
- */
- if (__netlink_create(&init_net, sock, cb_mutex, unit, 0) < 0)
+
+ if (__netlink_create(net, sock, cb_mutex, unit, 1) < 0)
goto out_sock_release_nosk;
sk = sock->sk;
- sk_change_net(sk, net);
if (!cfg || cfg->groups < 32)
groups = 32;
@@ -2538,7 +2533,10 @@ EXPORT_SYMBOL(__netlink_kernel_create);
void
netlink_kernel_release(struct sock *sk)
{
- sk_release_kernel(sk);
+ if (sk == NULL || sk->sk_socket == NULL)
+ return;
+
+ sock_release(sk->sk_socket);
}
EXPORT_SYMBOL(netlink_kernel_release);
--
2.2.1
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists