diff options
author | wangweidong <wangweidong1@huawei.com> | 2014-05-08 20:55:02 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-09 16:41:09 -0400 |
commit | f66138c8471442c24c58cdce6ba5f36c5ce93d7a (patch) | |
tree | 53c95dea1f7859caf3a475e0dc04ad33565ca2ce /net/sctp | |
parent | eb9f37053db5ea11101825d97442cf88754a48d1 (diff) |
sctp: add a checking for sctp_sysctl_net_register
When register_net_sysctl failed, we should free the
sysctl_table.
Signed-off-by: Wang Weidong <wangweidong1@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
-rw-r--r-- | net/sctp/sysctl.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index ee80eb45799d..7e5eb7554990 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c @@ -447,6 +447,10 @@ int sctp_sysctl_net_register(struct net *net) 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; } |