From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Westphal Subject: Re: [PATCH nf] netfilter: nf_ct_dccp/sctp: fix memory leak after netns cleanup Date: Mon, 19 Jun 2017 17:52:38 +0200 Message-ID: <20170619155238.GC28291@breakpoint.cc> References: <1496575054-17168-1-git-send-email-zlpnobody@163.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org, Liping Zhang , Davide Caratti To: Liping Zhang Return-path: Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:47406 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752577AbdFSPxe (ORCPT ); Mon, 19 Jun 2017 11:53:34 -0400 Content-Disposition: inline In-Reply-To: <1496575054-17168-1-git-send-email-zlpnobody@163.com> Sender: netfilter-devel-owner@vger.kernel.org List-ID: Liping Zhang wrote: > From: Liping Zhang > > After running the following commands for a while, kmemleak reported that > "1879 new suspected memory leaks" happened: > # while : ; do > ip netns add test > ip netns delete test > done Acked-by: Florian Westphal I think we might want to add this to nf-next: @@ -408,8 +410,10 @@ int nf_ct_l4proto_pernet_register_one(struct net *net, pn = nf_ct_l4proto_net(net, l4proto); - if (pn == NULL) + if (pn == NULL) { + ret = -EINVAL; goto out; + } so that nf_ct_l4proto_pernet_register_one() will return failure. Maybe even add a WARN_ON in nf_ct_l4proto_net() to catch this.