aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-10-27 01:54:53 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-27 01:54:53 -0400
commit2b008b0a8e96b726c603c5e1a5a7a509b5f61e35 (patch)
tree80d71a763d3e8365805203cf22093783e64e1bbc
parent72998d8c84247817c4b8b05b0256f29453e435f5 (diff)
[NET]: Marking struct pernet_operations __net_initdata was inappropriate
It is not safe to to place struct pernet_operations in a special section. We need struct pernet_operations to last until we call unregister_pernet_subsys. Which doesn't happen until module unload. So marking struct pernet_operations is a disaster for modules in two ways. - We discard it before we call the exit method it points to. - Because I keep struct pernet_operations on a linked list discarding it for compiled in code removes elements in the middle of a linked list and does horrible things for linked insert. So this looks safe assuming __exit_refok is not discarded for modules. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/loopback.c2
-rw-r--r--fs/proc/proc_net.c2
-rw-r--r--include/net/net_namespace.h2
-rw-r--r--net/core/dev.c6
-rw-r--r--net/core/dev_mcast.c2
-rw-r--r--net/netlink/af_netlink.c2
6 files changed, 7 insertions, 9 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 662b8d16803c..45f30a2974b8 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net)
284 unregister_netdev(dev); 284 unregister_netdev(dev);
285} 285}
286 286
287static struct pernet_operations __net_initdata loopback_net_ops = { 287static struct pernet_operations loopback_net_ops = {
288 .init = loopback_net_init, 288 .init = loopback_net_init,
289 .exit = loopback_net_exit, 289 .exit = loopback_net_exit,
290}; 290};
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
index 4edaad0d995f..749def054a34 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -185,7 +185,7 @@ static __net_exit void proc_net_ns_exit(struct net *net)
185 kfree(net->proc_net_root); 185 kfree(net->proc_net_root);
186} 186}
187 187
188static struct pernet_operations __net_initdata proc_net_ns_ops = { 188static struct pernet_operations proc_net_ns_ops = {
189 .init = proc_net_ns_init, 189 .init = proc_net_ns_init,
190 .exit = proc_net_ns_exit, 190 .exit = proc_net_ns_exit,
191}; 191};
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 93aa87d32804..5279466606d2 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -102,11 +102,9 @@ static inline void release_net(struct net *net)
102#ifdef CONFIG_NET_NS 102#ifdef CONFIG_NET_NS
103#define __net_init 103#define __net_init
104#define __net_exit 104#define __net_exit
105#define __net_initdata
106#else 105#else
107#define __net_init __init 106#define __net_init __init
108#define __net_exit __exit_refok 107#define __net_exit __exit_refok
109#define __net_initdata __initdata
110#endif 108#endif
111 109
112struct pernet_operations { 110struct pernet_operations {
diff --git a/net/core/dev.c b/net/core/dev.c
index ddfef3b45bab..853c8b575f1d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2668,7 +2668,7 @@ static void __net_exit dev_proc_net_exit(struct net *net)
2668 proc_net_remove(net, "dev"); 2668 proc_net_remove(net, "dev");
2669} 2669}
2670 2670
2671static struct pernet_operations __net_initdata dev_proc_ops = { 2671static struct pernet_operations dev_proc_ops = {
2672 .init = dev_proc_net_init, 2672 .init = dev_proc_net_init,
2673 .exit = dev_proc_net_exit, 2673 .exit = dev_proc_net_exit,
2674}; 2674};
@@ -4328,7 +4328,7 @@ static void __net_exit netdev_exit(struct net *net)
4328 kfree(net->dev_index_head); 4328 kfree(net->dev_index_head);
4329} 4329}
4330 4330
4331static struct pernet_operations __net_initdata netdev_net_ops = { 4331static struct pernet_operations netdev_net_ops = {
4332 .init = netdev_init, 4332 .init = netdev_init,
4333 .exit = netdev_exit, 4333 .exit = netdev_exit,
4334}; 4334};
@@ -4359,7 +4359,7 @@ static void __net_exit default_device_exit(struct net *net)
4359 rtnl_unlock(); 4359 rtnl_unlock();
4360} 4360}
4361 4361
4362static struct pernet_operations __net_initdata default_device_ops = { 4362static struct pernet_operations default_device_ops = {
4363 .exit = default_device_exit, 4363 .exit = default_device_exit,
4364}; 4364};
4365 4365
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index 15241cf48af8..ae354057d84c 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net)
285 proc_net_remove(net, "dev_mcast"); 285 proc_net_remove(net, "dev_mcast");
286} 286}
287 287
288static struct pernet_operations __net_initdata dev_mc_net_ops = { 288static struct pernet_operations dev_mc_net_ops = {
289 .init = dev_mc_net_init, 289 .init = dev_mc_net_init,
290 .exit = dev_mc_net_exit, 290 .exit = dev_mc_net_exit,
291}; 291};
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 325272925d0f..4f994c0fb3f8 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net)
1888#endif 1888#endif
1889} 1889}
1890 1890
1891static struct pernet_operations __net_initdata netlink_net_ops = { 1891static struct pernet_operations netlink_net_ops = {
1892 .init = netlink_net_init, 1892 .init = netlink_net_init,
1893 .exit = netlink_net_exit, 1893 .exit = netlink_net_exit,
1894}; 1894};