aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/8021q/vlan.c15
-rw-r--r--net/8021q/vlanproc.c12
-rw-r--r--net/8021q/vlanproc.h10
3 files changed, 22 insertions, 15 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 92966016a221..541542e2a2c1 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -642,8 +642,14 @@ static int vlan_init_net(struct net *net)
642 if (err < 0) 642 if (err < 0)
643 goto err_assign; 643 goto err_assign;
644 644
645 err = vlan_proc_init(net);
646 if (err < 0)
647 goto err_proc;
648
645 return 0; 649 return 0;
646 650
651err_proc:
652 /* nothing */
647err_assign: 653err_assign:
648 kfree(vn); 654 kfree(vn);
649err_alloc: 655err_alloc:
@@ -655,6 +661,7 @@ static void vlan_exit_net(struct net *net)
655 struct vlan_net *vn; 661 struct vlan_net *vn;
656 662
657 vn = net_generic(net, vlan_net_id); 663 vn = net_generic(net, vlan_net_id);
664 vlan_proc_cleanup(net);
658 kfree(vn); 665 kfree(vn);
659} 666}
660 667
@@ -674,10 +681,6 @@ static int __init vlan_proto_init(void)
674 if (err < 0) 681 if (err < 0)
675 goto err0; 682 goto err0;
676 683
677 err = vlan_proc_init();
678 if (err < 0)
679 goto err1;
680
681 err = register_netdevice_notifier(&vlan_notifier_block); 684 err = register_netdevice_notifier(&vlan_notifier_block);
682 if (err < 0) 685 if (err < 0)
683 goto err2; 686 goto err2;
@@ -693,8 +696,6 @@ static int __init vlan_proto_init(void)
693err3: 696err3:
694 unregister_netdevice_notifier(&vlan_notifier_block); 697 unregister_netdevice_notifier(&vlan_notifier_block);
695err2: 698err2:
696 vlan_proc_cleanup();
697err1:
698 unregister_pernet_gen_device(vlan_net_id, &vlan_net_ops); 699 unregister_pernet_gen_device(vlan_net_id, &vlan_net_ops);
699err0: 700err0:
700 return err; 701 return err;
@@ -715,8 +716,6 @@ static void __exit vlan_cleanup_module(void)
715 for (i = 0; i < VLAN_GRP_HASH_SIZE; i++) 716 for (i = 0; i < VLAN_GRP_HASH_SIZE; i++)
716 BUG_ON(!hlist_empty(&vlan_group_hash[i])); 717 BUG_ON(!hlist_empty(&vlan_group_hash[i]));
717 718
718 vlan_proc_cleanup();
719
720 unregister_pernet_gen_device(vlan_net_id, &vlan_net_ops); 719 unregister_pernet_gen_device(vlan_net_id, &vlan_net_ops);
721 720
722 synchronize_net(); 721 synchronize_net();
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 24cd96ee8109..4d13aeb88584 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -138,8 +138,11 @@ static const char *vlan_name_type_str[VLAN_NAME_TYPE_HIGHEST] = {
138 * Clean up /proc/net/vlan entries 138 * Clean up /proc/net/vlan entries
139 */ 139 */
140 140
141void vlan_proc_cleanup(void) 141void vlan_proc_cleanup(struct net *net)
142{ 142{
143 if (net != &init_net)
144 return;
145
143 if (proc_vlan_conf) 146 if (proc_vlan_conf)
144 remove_proc_entry(name_conf, proc_vlan_dir); 147 remove_proc_entry(name_conf, proc_vlan_dir);
145 148
@@ -155,8 +158,11 @@ void vlan_proc_cleanup(void)
155 * Create /proc/net/vlan entries 158 * Create /proc/net/vlan entries
156 */ 159 */
157 160
158int __init vlan_proc_init(void) 161int vlan_proc_init(struct net *net)
159{ 162{
163 if (net != &init_net)
164 return 0;
165
160 proc_vlan_dir = proc_mkdir(name_root, init_net.proc_net); 166 proc_vlan_dir = proc_mkdir(name_root, init_net.proc_net);
161 if (!proc_vlan_dir) 167 if (!proc_vlan_dir)
162 goto err; 168 goto err;
@@ -169,7 +175,7 @@ int __init vlan_proc_init(void)
169 175
170err: 176err:
171 pr_err("%s: can't create entry in proc filesystem!\n", __func__); 177 pr_err("%s: can't create entry in proc filesystem!\n", __func__);
172 vlan_proc_cleanup(); 178 vlan_proc_cleanup(net);
173 return -ENOBUFS; 179 return -ENOBUFS;
174} 180}
175 181
diff --git a/net/8021q/vlanproc.h b/net/8021q/vlanproc.h
index da542cacc5a5..063f60a3d5cc 100644
--- a/net/8021q/vlanproc.h
+++ b/net/8021q/vlanproc.h
@@ -2,15 +2,17 @@
2#define __BEN_VLAN_PROC_INC__ 2#define __BEN_VLAN_PROC_INC__
3 3
4#ifdef CONFIG_PROC_FS 4#ifdef CONFIG_PROC_FS
5int vlan_proc_init(void); 5struct net;
6
7int vlan_proc_init(struct net *net);
6int vlan_proc_rem_dev(struct net_device *vlandev); 8int vlan_proc_rem_dev(struct net_device *vlandev);
7int vlan_proc_add_dev(struct net_device *vlandev); 9int vlan_proc_add_dev(struct net_device *vlandev);
8void vlan_proc_cleanup(void); 10void vlan_proc_cleanup(struct net *net);
9 11
10#else /* No CONFIG_PROC_FS */ 12#else /* No CONFIG_PROC_FS */
11 13
12#define vlan_proc_init() (0) 14#define vlan_proc_init(net) (0)
13#define vlan_proc_cleanup() do {} while (0) 15#define vlan_proc_cleanup(net) do {} while (0)
14#define vlan_proc_add_dev(dev) ({(void)(dev), 0; }) 16#define vlan_proc_add_dev(dev) ({(void)(dev), 0; })
15#define vlan_proc_rem_dev(dev) ({(void)(dev), 0; }) 17#define vlan_proc_rem_dev(dev) ({(void)(dev), 0; })
16#endif 18#endif