aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sctp/protocol.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index f20bd708e89c..48a5989c98ce 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -93,8 +93,6 @@ int sysctl_sctp_wmem[3];
93/* Set up the proc fs entry for the SCTP protocol. */ 93/* Set up the proc fs entry for the SCTP protocol. */
94static __init int sctp_proc_init(void) 94static __init int sctp_proc_init(void)
95{ 95{
96 if (percpu_counter_init(&sctp_sockets_allocated, 0))
97 goto out_nomem;
98#ifdef CONFIG_PROC_FS 96#ifdef CONFIG_PROC_FS
99 if (!proc_net_sctp) { 97 if (!proc_net_sctp) {
100 proc_net_sctp = proc_mkdir("sctp", init_net.proc_net); 98 proc_net_sctp = proc_mkdir("sctp", init_net.proc_net);
@@ -125,12 +123,9 @@ out_snmp_proc_init:
125 remove_proc_entry("sctp", init_net.proc_net); 123 remove_proc_entry("sctp", init_net.proc_net);
126 } 124 }
127out_free_percpu: 125out_free_percpu:
128 percpu_counter_destroy(&sctp_sockets_allocated);
129#else 126#else
130 return 0; 127 return 0;
131#endif /* CONFIG_PROC_FS */ 128#endif /* CONFIG_PROC_FS */
132
133out_nomem:
134 return -ENOMEM; 129 return -ENOMEM;
135} 130}
136 131
@@ -151,7 +146,6 @@ static void sctp_proc_exit(void)
151 remove_proc_entry("sctp", init_net.proc_net); 146 remove_proc_entry("sctp", init_net.proc_net);
152 } 147 }
153#endif 148#endif
154 percpu_counter_destroy(&sctp_sockets_allocated);
155} 149}
156 150
157/* Private helper to extract ipv4 address and stash them in 151/* Private helper to extract ipv4 address and stash them in
@@ -1261,6 +1255,10 @@ SCTP_STATIC __init int sctp_init(void)
1261 if (status) 1255 if (status)
1262 goto err_init_mibs; 1256 goto err_init_mibs;
1263 1257
1258 status = percpu_counter_init(&sctp_sockets_allocated, 0);
1259 if (status)
1260 goto err_percpu_counter_init;
1261
1264 /* Initialize proc fs directory. */ 1262 /* Initialize proc fs directory. */
1265 status = sctp_proc_init(); 1263 status = sctp_proc_init();
1266 if (status) 1264 if (status)
@@ -1481,6 +1479,8 @@ err_ahash_alloc:
1481 sctp_dbg_objcnt_exit(); 1479 sctp_dbg_objcnt_exit();
1482 sctp_proc_exit(); 1480 sctp_proc_exit();
1483err_init_proc: 1481err_init_proc:
1482 percpu_counter_destroy(&sctp_sockets_allocated);
1483err_percpu_counter_init:
1484 cleanup_sctp_mibs(); 1484 cleanup_sctp_mibs();
1485err_init_mibs: 1485err_init_mibs:
1486 kmem_cache_destroy(sctp_chunk_cachep); 1486 kmem_cache_destroy(sctp_chunk_cachep);
@@ -1521,6 +1521,7 @@ SCTP_STATIC __exit void sctp_exit(void)
1521 sizeof(struct sctp_bind_hashbucket))); 1521 sizeof(struct sctp_bind_hashbucket)));
1522 1522
1523 sctp_dbg_objcnt_exit(); 1523 sctp_dbg_objcnt_exit();
1524 percpu_counter_destroy(&sctp_sockets_allocated);
1524 sctp_proc_exit(); 1525 sctp_proc_exit();
1525 cleanup_sctp_mibs(); 1526 cleanup_sctp_mibs();
1526 1527