From: wangweidong Date: Thu, 8 May 2014 12:55:02 +0000 (+0800) Subject: sctp: add a checking for sctp_sysctl_net_register X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f66138c8471442c24c58cdce6ba5f36c5ce93d7a;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Signed-off-by: David S. Miller --- 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; }