Commit 05ab2dae authored by David S. Miller's avatar David S. Miller

Merge branch 'sctp_sysctl'

Wang Weidong says:

====================
sctp: fix kfree static array pointer in sctp_sysctl_net_unregister

patch #1 revert the efb842c4("sctp: optimize the sctp_sysctl_net_register")
patch #2 add a checking for sctp_sysctl_net_register
====================
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 93dccc59 f66138c8
...@@ -436,9 +436,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write, ...@@ -436,9 +436,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,
int sctp_sysctl_net_register(struct net *net) int sctp_sysctl_net_register(struct net *net)
{ {
struct ctl_table *table = sctp_net_table; struct ctl_table *table;
if (!net_eq(net, &init_net)) {
int i; int i;
table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL); table = kmemdup(sctp_net_table, sizeof(sctp_net_table), GFP_KERNEL);
...@@ -447,9 +445,12 @@ int sctp_sysctl_net_register(struct net *net) ...@@ -447,9 +445,12 @@ int sctp_sysctl_net_register(struct net *net)
for (i = 0; table[i].data; i++) for (i = 0; table[i].data; i++)
table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp; table[i].data += (char *)(&net->sctp) - (char *)&init_net.sctp;
}
net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table); net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table);
if (net->sctp.sysctl_header == NULL) {
kfree(table);
return -ENOMEM;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment