]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
sctp: add a checking for sctp_sysctl_net_register
authorwangweidong <wangweidong1@huawei.com>
Thu, 8 May 2014 12:55:02 +0000 (20:55 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 9 May 2014 20:41:09 +0000 (16:41 -0400)
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>
net/sctp/sysctl.c

index ee80eb45799d6eeae910f6ce15fadfa1be0966f9..7e5eb75549902eeeb2c0c0889daca8ee53317ccf 100644 (file)
@@ -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;
 }