summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-05-09 16:41:16 -0400
committerDavid S. Miller <davem@davemloft.net>2014-05-09 16:41:16 -0400
commit05ab2dae650e09add1c5295392b5516704c03a4b (patch)
tree53c95dea1f7859caf3a475e0dc04ad33565ca2ce
parent93dccc59165ad1b4db94528dfdf88bff92c09cef (diff)
parentf66138c8471442c24c58cdce6ba5f36c5ce93d7a (diff)
Merge branch 'sctp_sysctl'
Wang Weidong says: ==================== sctp: fix kfree static array pointer in sctp_sysctl_net_unregister patch #1 revert the efb842c45("sctp: optimize the sctp_sysctl_net_register") patch #2 add a checking for sctp_sysctl_net_register ==================== Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sctp/sysctl.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index c82fdc1eab7c..7e5eb7554990 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -436,20 +436,21 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
int sctp_sysctl_net_register(struct net *net)
{
- struct ctl_table *table = sctp_net_table;
-
- if (!net_eq(net, &init_net)) {
- int i;
+ struct ctl_table *table;
+ int i;
- table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
- if (!table)
- return -ENOMEM;
+ table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
+ if (!table)
+ return -ENOMEM;
- for (i = 0; table[i].data; i++)
- table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
- }
+ for (i = 0; table[i].data; i++)
+ table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);
+ if (net->sctp.sysctl_header == NULL) {
+ kfree(table);
+ return -ENOMEM;
+ }
return 0;
}