summaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index 606361ee9e4a..493b817f6a2a 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -80,56 +80,6 @@ long sysctl_sctp_mem[3];
80int sysctl_sctp_rmem[3]; 80int sysctl_sctp_rmem[3];
81int sysctl_sctp_wmem[3]; 81int sysctl_sctp_wmem[3];
82 82
83/* Set up the proc fs entry for the SCTP protocol. */
84static int __net_init sctp_proc_init(struct net *net)
85{
86#ifdef CONFIG_PROC_FS
87 net->sctp.proc_net_sctp = proc_net_mkdir(net, "sctp", net->proc_net);
88 if (!net->sctp.proc_net_sctp)
89 goto out_proc_net_sctp;
90 if (sctp_snmp_proc_init(net))
91 goto out_snmp_proc_init;
92 if (sctp_eps_proc_init(net))
93 goto out_eps_proc_init;
94 if (sctp_assocs_proc_init(net))
95 goto out_assocs_proc_init;
96 if (sctp_remaddr_proc_init(net))
97 goto out_remaddr_proc_init;
98
99 return 0;
100
101out_remaddr_proc_init:
102 sctp_assocs_proc_exit(net);
103out_assocs_proc_init:
104 sctp_eps_proc_exit(net);
105out_eps_proc_init:
106 sctp_snmp_proc_exit(net);
107out_snmp_proc_init:
108 remove_proc_entry("sctp", net->proc_net);
109 net->sctp.proc_net_sctp = NULL;
110out_proc_net_sctp:
111 return -ENOMEM;
112#endif /* CONFIG_PROC_FS */
113 return 0;
114}
115
116/* Clean up the proc fs entry for the SCTP protocol.
117 * Note: Do not make this __exit as it is used in the init error
118 * path.
119 */
120static void sctp_proc_exit(struct net *net)
121{
122#ifdef CONFIG_PROC_FS
123 sctp_snmp_proc_exit(net);
124 sctp_eps_proc_exit(net);
125 sctp_assocs_proc_exit(net);
126 sctp_remaddr_proc_exit(net);
127
128 remove_proc_entry("sctp", net->proc_net);
129 net->sctp.proc_net_sctp = NULL;
130#endif
131}
132
133/* Private helper to extract ipv4 address and stash them in 83/* Private helper to extract ipv4 address and stash them in
134 * the protocol structure. 84 * the protocol structure.
135 */ 85 */
@@ -1285,10 +1235,12 @@ static int __net_init sctp_defaults_init(struct net *net)
1285 if (status) 1235 if (status)
1286 goto err_init_mibs; 1236 goto err_init_mibs;
1287 1237
1238#ifdef CONFIG_PROC_FS
1288 /* Initialize proc fs directory. */ 1239 /* Initialize proc fs directory. */
1289 status = sctp_proc_init(net); 1240 status = sctp_proc_init(net);
1290 if (status) 1241 if (status)
1291 goto err_init_proc; 1242 goto err_init_proc;
1243#endif
1292 1244
1293 sctp_dbg_objcnt_init(net); 1245 sctp_dbg_objcnt_init(net);
1294 1246
@@ -1320,9 +1272,10 @@ static void __net_exit sctp_defaults_exit(struct net *net)
1320 sctp_free_addr_wq(net); 1272 sctp_free_addr_wq(net);
1321 sctp_free_local_addr_list(net); 1273 sctp_free_local_addr_list(net);
1322 1274
1323 sctp_dbg_objcnt_exit(net); 1275#ifdef CONFIG_PROC_FS
1324 1276 remove_proc_subtree("sctp", net->proc_net);
1325 sctp_proc_exit(net); 1277 net->sctp.proc_net_sctp = NULL;
1278#endif
1326 cleanup_sctp_mibs(net); 1279 cleanup_sctp_mibs(net);
1327 sctp_sysctl_net_unregister(net); 1280 sctp_sysctl_net_unregister(net);
1328} 1281}