aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/connector/connector.c9
-rw-r--r--drivers/scsi/scsi_netlink.c2
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c4
-rw-r--r--fs/ecryptfs/netlink.c3
-rw-r--r--include/linux/netlink.h1
-rw-r--r--net/bridge/netfilter/ebt_ulog.c4
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/decnet/netfilter/dn_rtmsg.c4
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/inet_diag.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c4
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c4
-rw-r--r--net/ipv6/netfilter/ip6_queue.c4
-rw-r--r--net/netfilter/nfnetlink.c2
-rw-r--r--net/netlink/af_netlink.c11
-rw-r--r--net/xfrm/xfrm_user.c2
16 files changed, 34 insertions, 26 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 37976dcf044b..fea2d3ed9cbd 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -420,8 +420,7 @@ static int __devinit cn_init(void)
420 420
421 dev->cbdev = cn_queue_alloc_dev("cqueue", dev->nls); 421 dev->cbdev = cn_queue_alloc_dev("cqueue", dev->nls);
422 if (!dev->cbdev) { 422 if (!dev->cbdev) {
423 if (dev->nls->sk_socket) 423 netlink_kernel_release(dev->nls);
424 sock_release(dev->nls->sk_socket);
425 return -EINVAL; 424 return -EINVAL;
426 } 425 }
427 426
@@ -431,8 +430,7 @@ static int __devinit cn_init(void)
431 if (err) { 430 if (err) {
432 cn_already_initialized = 0; 431 cn_already_initialized = 0;
433 cn_queue_free_dev(dev->cbdev); 432 cn_queue_free_dev(dev->cbdev);
434 if (dev->nls->sk_socket) 433 netlink_kernel_release(dev->nls);
435 sock_release(dev->nls->sk_socket);
436 return -EINVAL; 434 return -EINVAL;
437 } 435 }
438 436
@@ -447,8 +445,7 @@ static void __devexit cn_fini(void)
447 445
448 cn_del_callback(&dev->id); 446 cn_del_callback(&dev->id);
449 cn_queue_free_dev(dev->cbdev); 447 cn_queue_free_dev(dev->cbdev);
450 if (dev->nls->sk_socket) 448 netlink_kernel_release(dev->nls);
451 sock_release(dev->nls->sk_socket);
452} 449}
453 450
454subsys_initcall(cn_init); 451subsys_initcall(cn_init);
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c
index 3e1591828171..370c78cc1cb5 100644
--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -164,7 +164,7 @@ void
164scsi_netlink_exit(void) 164scsi_netlink_exit(void)
165{ 165{
166 if (scsi_nl_sock) { 166 if (scsi_nl_sock) {
167 sock_release(scsi_nl_sock->sk_socket); 167 netlink_kernel_release(scsi_nl_sock);
168 netlink_unregister_notifier(&scsi_netlink_notifier); 168 netlink_unregister_notifier(&scsi_netlink_notifier);
169 } 169 }
170 170
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index ef0e74264880..0d7b4e79415c 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1558,7 +1558,7 @@ static __init int iscsi_transport_init(void)
1558 return 0; 1558 return 0;
1559 1559
1560release_nls: 1560release_nls:
1561 sock_release(nls->sk_socket); 1561 netlink_kernel_release(nls);
1562unregister_session_class: 1562unregister_session_class:
1563 transport_class_unregister(&iscsi_session_class); 1563 transport_class_unregister(&iscsi_session_class);
1564unregister_conn_class: 1564unregister_conn_class:
@@ -1573,7 +1573,7 @@ unregister_transport_class:
1573static void __exit iscsi_transport_exit(void) 1573static void __exit iscsi_transport_exit(void)
1574{ 1574{
1575 destroy_workqueue(iscsi_eh_timer_workq); 1575 destroy_workqueue(iscsi_eh_timer_workq);
1576 sock_release(nls->sk_socket); 1576 netlink_kernel_release(nls);
1577 transport_class_unregister(&iscsi_connection_class); 1577 transport_class_unregister(&iscsi_connection_class);
1578 transport_class_unregister(&iscsi_session_class); 1578 transport_class_unregister(&iscsi_session_class);
1579 transport_class_unregister(&iscsi_host_class); 1579 transport_class_unregister(&iscsi_host_class);
diff --git a/fs/ecryptfs/netlink.c b/fs/ecryptfs/netlink.c
index 9aa345121e09..f638a698dc52 100644
--- a/fs/ecryptfs/netlink.c
+++ b/fs/ecryptfs/netlink.c
@@ -237,7 +237,6 @@ out:
237 */ 237 */
238void ecryptfs_release_netlink(void) 238void ecryptfs_release_netlink(void)
239{ 239{
240 if (ecryptfs_nl_sock && ecryptfs_nl_sock->sk_socket) 240 netlink_kernel_release(ecryptfs_nl_sock);
241 sock_release(ecryptfs_nl_sock->sk_socket);
242 ecryptfs_nl_sock = NULL; 241 ecryptfs_nl_sock = NULL;
243} 242}
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2aee0f510876..bd13b6f4a98e 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -178,6 +178,7 @@ extern struct sock *netlink_kernel_create(struct net *net,
178 void (*input)(struct sk_buff *skb), 178 void (*input)(struct sk_buff *skb),
179 struct mutex *cb_mutex, 179 struct mutex *cb_mutex,
180 struct module *module); 180 struct module *module);
181extern void netlink_kernel_release(struct sock *sk);
181extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 182extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
182extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 183extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
183extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 184extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index b73ba28bcbe8..8e7b00b68d38 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -307,7 +307,7 @@ static int __init ebt_ulog_init(void)
307 if (!ebtulognl) 307 if (!ebtulognl)
308 ret = -ENOMEM; 308 ret = -ENOMEM;
309 else if ((ret = ebt_register_watcher(&ulog))) 309 else if ((ret = ebt_register_watcher(&ulog)))
310 sock_release(ebtulognl->sk_socket); 310 netlink_kernel_release(ebtulognl);
311 311
312 if (ret == 0) 312 if (ret == 0)
313 nf_log_register(PF_BRIDGE, &ebt_ulog_logger); 313 nf_log_register(PF_BRIDGE, &ebt_ulog_logger);
@@ -333,7 +333,7 @@ static void __exit ebt_ulog_fini(void)
333 } 333 }
334 spin_unlock_bh(&ub->lock); 334 spin_unlock_bh(&ub->lock);
335 } 335 }
336 sock_release(ebtulognl->sk_socket); 336 netlink_kernel_release(ebtulognl);
337} 337}
338 338
339module_init(ebt_ulog_init); 339module_init(ebt_ulog_init);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index a5f4f661fa62..02cf848f71d2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1384,7 +1384,7 @@ static void rtnetlink_net_exit(struct net *net)
1384 * free. 1384 * free.
1385 */ 1385 */
1386 sk->sk_net = get_net(&init_net); 1386 sk->sk_net = get_net(&init_net);
1387 sock_release(net->rtnl->sk_socket); 1387 netlink_kernel_release(net->rtnl);
1388 net->rtnl = NULL; 1388 net->rtnl = NULL;
1389 } 1389 }
1390} 1390}
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c
index 96375f2e64ff..6d2bd3202048 100644
--- a/net/decnet/netfilter/dn_rtmsg.c
+++ b/net/decnet/netfilter/dn_rtmsg.c
@@ -137,7 +137,7 @@ static int __init dn_rtmsg_init(void)
137 137
138 rv = nf_register_hook(&dnrmg_ops); 138 rv = nf_register_hook(&dnrmg_ops);
139 if (rv) { 139 if (rv) {
140 sock_release(dnrmg->sk_socket); 140 netlink_kernel_release(dnrmg);
141 } 141 }
142 142
143 return rv; 143 return rv;
@@ -146,7 +146,7 @@ static int __init dn_rtmsg_init(void)
146static void __exit dn_rtmsg_fini(void) 146static void __exit dn_rtmsg_fini(void)
147{ 147{
148 nf_unregister_hook(&dnrmg_ops); 148 nf_unregister_hook(&dnrmg_ops);
149 sock_release(dnrmg->sk_socket); 149 netlink_kernel_release(dnrmg);
150} 150}
151 151
152 152
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 4e5216e9aacb..e787d2151152 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -881,7 +881,7 @@ static void nl_fib_lookup_exit(struct net *net)
881 * initial network namespace. So the socket will be safe to free. 881 * initial network namespace. So the socket will be safe to free.
882 */ 882 */
883 net->ipv4.fibnl->sk_net = get_net(&init_net); 883 net->ipv4.fibnl->sk_net = get_net(&init_net);
884 sock_release(net->ipv4.fibnl->sk_socket); 884 netlink_kernel_release(net->ipv4.fibnl);
885} 885}
886 886
887static void fib_disable_ip(struct net_device *dev, int force) 887static void fib_disable_ip(struct net_device *dev, int force)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index e468e7a7aac4..605ed2cd7972 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -935,7 +935,7 @@ out_free_table:
935 935
936static void __exit inet_diag_exit(void) 936static void __exit inet_diag_exit(void)
937{ 937{
938 sock_release(idiagnl->sk_socket); 938 netlink_kernel_release(idiagnl);
939 kfree(inet_diag_table); 939 kfree(inet_diag_table);
940} 940}
941 941
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 7361315f20c6..5109839da222 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -605,7 +605,7 @@ cleanup_sysctl:
605 unregister_netdevice_notifier(&ipq_dev_notifier); 605 unregister_netdevice_notifier(&ipq_dev_notifier);
606 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 606 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
607cleanup_ipqnl: 607cleanup_ipqnl:
608 sock_release(ipqnl->sk_socket); 608 netlink_kernel_release(ipqnl);
609 mutex_lock(&ipqnl_mutex); 609 mutex_lock(&ipqnl_mutex);
610 mutex_unlock(&ipqnl_mutex); 610 mutex_unlock(&ipqnl_mutex);
611 611
@@ -624,7 +624,7 @@ static void __exit ip_queue_fini(void)
624 unregister_netdevice_notifier(&ipq_dev_notifier); 624 unregister_netdevice_notifier(&ipq_dev_notifier);
625 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 625 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
626 626
627 sock_release(ipqnl->sk_socket); 627 netlink_kernel_release(ipqnl);
628 mutex_lock(&ipqnl_mutex); 628 mutex_lock(&ipqnl_mutex);
629 mutex_unlock(&ipqnl_mutex); 629 mutex_unlock(&ipqnl_mutex);
630 630
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index fa24efaf3eaa..b192756c6d0d 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -415,7 +415,7 @@ static int __init ulog_tg_init(void)
415 415
416 ret = xt_register_target(&ulog_tg_reg); 416 ret = xt_register_target(&ulog_tg_reg);
417 if (ret < 0) { 417 if (ret < 0) {
418 sock_release(nflognl->sk_socket); 418 netlink_kernel_release(nflognl);
419 return ret; 419 return ret;
420 } 420 }
421 if (nflog) 421 if (nflog)
@@ -434,7 +434,7 @@ static void __exit ulog_tg_exit(void)
434 if (nflog) 434 if (nflog)
435 nf_log_unregister(&ipt_ulog_logger); 435 nf_log_unregister(&ipt_ulog_logger);
436 xt_unregister_target(&ulog_tg_reg); 436 xt_unregister_target(&ulog_tg_reg);
437 sock_release(nflognl->sk_socket); 437 netlink_kernel_release(nflognl);
438 438
439 /* remove pending timers and free allocated skb's */ 439 /* remove pending timers and free allocated skb's */
440 for (i = 0; i < ULOG_MAXNLGROUPS; i++) { 440 for (i = 0; i < ULOG_MAXNLGROUPS; i++) {
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index a20db0bb5a1f..56b4ea6d29ed 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -609,7 +609,7 @@ cleanup_sysctl:
609 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 609 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
610 610
611cleanup_ipqnl: 611cleanup_ipqnl:
612 sock_release(ipqnl->sk_socket); 612 netlink_kernel_release(ipqnl);
613 mutex_lock(&ipqnl_mutex); 613 mutex_lock(&ipqnl_mutex);
614 mutex_unlock(&ipqnl_mutex); 614 mutex_unlock(&ipqnl_mutex);
615 615
@@ -628,7 +628,7 @@ static void __exit ip6_queue_fini(void)
628 unregister_netdevice_notifier(&ipq_dev_notifier); 628 unregister_netdevice_notifier(&ipq_dev_notifier);
629 proc_net_remove(&init_net, IPQ_PROC_FS_NAME); 629 proc_net_remove(&init_net, IPQ_PROC_FS_NAME);
630 630
631 sock_release(ipqnl->sk_socket); 631 netlink_kernel_release(ipqnl);
632 mutex_lock(&ipqnl_mutex); 632 mutex_lock(&ipqnl_mutex);
633 mutex_unlock(&ipqnl_mutex); 633 mutex_unlock(&ipqnl_mutex);
634 634
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 2128542995f7..b75c9c4a995d 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -179,7 +179,7 @@ static void nfnetlink_rcv(struct sk_buff *skb)
179static void __exit nfnetlink_exit(void) 179static void __exit nfnetlink_exit(void)
180{ 180{
181 printk("Removing netfilter NETLINK layer.\n"); 181 printk("Removing netfilter NETLINK layer.\n");
182 sock_release(nfnl->sk_socket); 182 netlink_kernel_release(nfnl);
183 return; 183 return;
184} 184}
185 185
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 29fef558aab6..626a58206298 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1405,6 +1405,17 @@ out_sock_release:
1405} 1405}
1406EXPORT_SYMBOL(netlink_kernel_create); 1406EXPORT_SYMBOL(netlink_kernel_create);
1407 1407
1408
1409void
1410netlink_kernel_release(struct sock *sk)
1411{
1412 if (sk == NULL || sk->sk_socket == NULL)
1413 return;
1414 sock_release(sk->sk_socket);
1415}
1416EXPORT_SYMBOL(netlink_kernel_release);
1417
1418
1408/** 1419/**
1409 * netlink_change_ngroups - change number of multicast groups 1420 * netlink_change_ngroups - change number of multicast groups
1410 * 1421 *
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 35fc16ae50ac..e0ccdf267813 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2420,7 +2420,7 @@ static void __exit xfrm_user_exit(void)
2420 xfrm_unregister_km(&netlink_mgr); 2420 xfrm_unregister_km(&netlink_mgr);
2421 rcu_assign_pointer(xfrm_nl, NULL); 2421 rcu_assign_pointer(xfrm_nl, NULL);
2422 synchronize_rcu(); 2422 synchronize_rcu();
2423 sock_release(nlsk->sk_socket); 2423 netlink_kernel_release(nlsk);
2424} 2424}
2425 2425
2426module_init(xfrm_user_init); 2426module_init(xfrm_user_init);