aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-22 11:28:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-22 11:28:16 -0400
commitf75b6f303bd80249a56cce9028954b4f731270e3 (patch)
tree3efcb909852964382b7b34fc4942a2eee0284a8c /net/tipc
parent86f9e56d08852961a1b9e062d59b71491d8c793a (diff)
parentad70411a978d1e6e97b1e341a7bde9a79af0c93d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Clear up some recent tipc regressions because of registration ordering. Fix from Junwei Hu. 2) tipc's TLV_SET() can read past the end of the supplied buffer during the copy. From Chris Packham. 3) ptp example program doesn't match the kernel, from Richard Cochran. 4) Outgoing message type fix in qrtr, from Bjorn Andersson. 5) Flow control regression in stmmac, from Tan Tee Min. 6) Fix inband autonegotiation in phylink, from Russell King. 7) Fix sk_bound_dev_if handling in rawv6_bind(), from Mike Manning. 8) Fix usbnet crash after disconnect, from Kloetzke Jan. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (21 commits) usbnet: fix kernel crash after disconnect selftests: fib_rule_tests: use pre-defined DEV_ADDR net-next: net: Fix typos in ip-sysctl.txt ipv6: Consider sk_bound_dev_if when binding a raw socket to an address net: phylink: ensure inband AN works correctly usbnet: ipheth: fix racing condition net: stmmac: dma channel control register need to be init first net: stmmac: fix ethtool flow control not able to get/set net: qrtr: Fix message type of outgoing packets networking: : fix typos in code comments ptp: Fix example program to match kernel. fddi: fix typos in code comments selftests: fib_rule_tests: enable forwarding before ipv4 from/iif test selftests: fib_rule_tests: fix local IPv4 address typo tipc: Avoid copying bytes beyond the supplied data 2/2] net: xilinx_emaclite: use readx_poll_timeout() in mdio wait function 1/2] net: axienet: use readx_poll_timeout() in mdio wait function vlan: Mark expected switch fall-through macvlan: Mark expected switch fall-through net/mlx4_en: ethtool, Remove unsupported SFP EEPROM high pages query ...
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/core.c18
-rw-r--r--net/tipc/subscr.h5
-rw-r--r--net/tipc/topsrv.c14
3 files changed, 27 insertions, 10 deletions
diff --git a/net/tipc/core.c b/net/tipc/core.c
index ddd2e0f67c07..ed536c05252a 100644
--- a/net/tipc/core.c
+++ b/net/tipc/core.c
@@ -77,9 +77,6 @@ static int __net_init tipc_init_net(struct net *net)
77 goto out_nametbl; 77 goto out_nametbl;
78 78
79 INIT_LIST_HEAD(&tn->dist_queue); 79 INIT_LIST_HEAD(&tn->dist_queue);
80 err = tipc_topsrv_start(net);
81 if (err)
82 goto out_subscr;
83 80
84 err = tipc_bcast_init(net); 81 err = tipc_bcast_init(net);
85 if (err) 82 if (err)
@@ -88,8 +85,6 @@ static int __net_init tipc_init_net(struct net *net)
88 return 0; 85 return 0;
89 86
90out_bclink: 87out_bclink:
91 tipc_bcast_stop(net);
92out_subscr:
93 tipc_nametbl_stop(net); 88 tipc_nametbl_stop(net);
94out_nametbl: 89out_nametbl:
95 tipc_sk_rht_destroy(net); 90 tipc_sk_rht_destroy(net);
@@ -99,7 +94,6 @@ out_sk_rht:
99 94
100static void __net_exit tipc_exit_net(struct net *net) 95static void __net_exit tipc_exit_net(struct net *net)
101{ 96{
102 tipc_topsrv_stop(net);
103 tipc_net_stop(net); 97 tipc_net_stop(net);
104 tipc_bcast_stop(net); 98 tipc_bcast_stop(net);
105 tipc_nametbl_stop(net); 99 tipc_nametbl_stop(net);
@@ -113,6 +107,11 @@ static struct pernet_operations tipc_net_ops = {
113 .size = sizeof(struct tipc_net), 107 .size = sizeof(struct tipc_net),
114}; 108};
115 109
110static struct pernet_operations tipc_topsrv_net_ops = {
111 .init = tipc_topsrv_init_net,
112 .exit = tipc_topsrv_exit_net,
113};
114
116static int __init tipc_init(void) 115static int __init tipc_init(void)
117{ 116{
118 int err; 117 int err;
@@ -143,6 +142,10 @@ static int __init tipc_init(void)
143 if (err) 142 if (err)
144 goto out_socket; 143 goto out_socket;
145 144
145 err = register_pernet_subsys(&tipc_topsrv_net_ops);
146 if (err)
147 goto out_pernet_topsrv;
148
146 err = tipc_bearer_setup(); 149 err = tipc_bearer_setup();
147 if (err) 150 if (err)
148 goto out_bearer; 151 goto out_bearer;
@@ -150,6 +153,8 @@ static int __init tipc_init(void)
150 pr_info("Started in single node mode\n"); 153 pr_info("Started in single node mode\n");
151 return 0; 154 return 0;
152out_bearer: 155out_bearer:
156 unregister_pernet_subsys(&tipc_topsrv_net_ops);
157out_pernet_topsrv:
153 tipc_socket_stop(); 158 tipc_socket_stop();
154out_socket: 159out_socket:
155 unregister_pernet_subsys(&tipc_net_ops); 160 unregister_pernet_subsys(&tipc_net_ops);
@@ -167,6 +172,7 @@ out_netlink:
167static void __exit tipc_exit(void) 172static void __exit tipc_exit(void)
168{ 173{
169 tipc_bearer_cleanup(); 174 tipc_bearer_cleanup();
175 unregister_pernet_subsys(&tipc_topsrv_net_ops);
170 tipc_socket_stop(); 176 tipc_socket_stop();
171 unregister_pernet_subsys(&tipc_net_ops); 177 unregister_pernet_subsys(&tipc_net_ops);
172 tipc_netlink_stop(); 178 tipc_netlink_stop();
diff --git a/net/tipc/subscr.h b/net/tipc/subscr.h
index d793b4343885..aa015c233898 100644
--- a/net/tipc/subscr.h
+++ b/net/tipc/subscr.h
@@ -77,8 +77,9 @@ void tipc_sub_report_overlap(struct tipc_subscription *sub,
77 u32 found_lower, u32 found_upper, 77 u32 found_lower, u32 found_upper,
78 u32 event, u32 port, u32 node, 78 u32 event, u32 port, u32 node,
79 u32 scope, int must); 79 u32 scope, int must);
80int tipc_topsrv_start(struct net *net); 80
81void tipc_topsrv_stop(struct net *net); 81int __net_init tipc_topsrv_init_net(struct net *net);
82void __net_exit tipc_topsrv_exit_net(struct net *net);
82 83
83void tipc_sub_put(struct tipc_subscription *subscription); 84void tipc_sub_put(struct tipc_subscription *subscription);
84void tipc_sub_get(struct tipc_subscription *subscription); 85void tipc_sub_get(struct tipc_subscription *subscription);
diff --git a/net/tipc/topsrv.c b/net/tipc/topsrv.c
index b45932d78004..f345662890a6 100644
--- a/net/tipc/topsrv.c
+++ b/net/tipc/topsrv.c
@@ -635,7 +635,7 @@ static void tipc_topsrv_work_stop(struct tipc_topsrv *s)
635 destroy_workqueue(s->send_wq); 635 destroy_workqueue(s->send_wq);
636} 636}
637 637
638int tipc_topsrv_start(struct net *net) 638static int tipc_topsrv_start(struct net *net)
639{ 639{
640 struct tipc_net *tn = tipc_net(net); 640 struct tipc_net *tn = tipc_net(net);
641 const char name[] = "topology_server"; 641 const char name[] = "topology_server";
@@ -668,7 +668,7 @@ int tipc_topsrv_start(struct net *net)
668 return ret; 668 return ret;
669} 669}
670 670
671void tipc_topsrv_stop(struct net *net) 671static void tipc_topsrv_stop(struct net *net)
672{ 672{
673 struct tipc_topsrv *srv = tipc_topsrv(net); 673 struct tipc_topsrv *srv = tipc_topsrv(net);
674 struct socket *lsock = srv->listener; 674 struct socket *lsock = srv->listener;
@@ -693,3 +693,13 @@ void tipc_topsrv_stop(struct net *net)
693 idr_destroy(&srv->conn_idr); 693 idr_destroy(&srv->conn_idr);
694 kfree(srv); 694 kfree(srv);
695} 695}
696
697int __net_init tipc_topsrv_init_net(struct net *net)
698{
699 return tipc_topsrv_start(net);
700}
701
702void __net_exit tipc_topsrv_exit_net(struct net *net)
703{
704 tipc_topsrv_stop(net);
705}