From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wang Weidong Subject: Re: [PATCH net-next] sctp: add a checking for sctp_sysctl_net_register Date: Thu, 8 May 2014 19:26:27 +0800 Message-ID: <536B69E3.1090104@huawei.com> References: <536B3859.2050908@huawei.com> <20140508111126.GC9696@hmsreliant.think-freely.org> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Cc: David Miller , Vlad Yasevich , Daniel Borkmann , , To: Neil Horman Return-path: Received: from szxga01-in.huawei.com ([119.145.14.64]:18670 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954AbaEHL2a (ORCPT ); Thu, 8 May 2014 07:28:30 -0400 In-Reply-To: <20140508111126.GC9696@hmsreliant.think-freely.org> Sender: netdev-owner@vger.kernel.org List-ID: On 2014/5/8 19:11, Neil Horman wrote: > On Thu, May 08, 2014 at 03:55:05PM +0800, Wang Weidong wrote: >> When register_net_sysctl failed, we should free the >> sysctl_table while the net_namespace is not init_net. >> >> Signed-off-by: Wang Weidong >> --- >> net/sctp/sysctl.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c >> index 844d2b0..4c17694 100644 >> --- a/net/sctp/sysctl.c >> +++ b/net/sctp/sysctl.c >> @@ -450,6 +450,11 @@ int sctp_sysctl_net_register(struct net *net) >> } >> >> net->sctp.sysctl_header = register_net_sysctl(net, "net/sctp", table); >> + if (net->sctp.sysctl_header == NULL) { >> + if (!net_eq(net, &init_net)) >> + kfree(table); >> + return -ENOMEM; >> + } > Sorry, we're not special casing this in 3 places. Why not just revert the > origonal commit so that all the sysctl tables can be handled the same way > Neil > Hi Neil, The original commit avoids to kmemdup >> return 0; >> } >> >> -- >> 1.7.12 >> >> >> > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > >