From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: [PATCH nf] netfilter: nf_tables: move dumper state alloation into ->start Date: Mon, 23 Jul 2018 13:09:11 +0200 Message-ID: <20180723110911.guinjwo5vglcyw2z@salvia> References: <20180723104714.24008-1-fw@strlen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org, cscnull@gmail.com To: Florian Westphal Return-path: Received: from mail.us.es ([193.147.175.20]:45778 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387816AbeGWMKs (ORCPT ); Mon, 23 Jul 2018 08:10:48 -0400 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 90E774BCDD for ; Mon, 23 Jul 2018 13:08:07 +0200 (CEST) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id ECEA69D626 for ; Mon, 23 Jul 2018 13:08:06 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20180723104714.24008-1-fw@strlen.de> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Jul 23, 2018 at 12:47:14PM +0200, Florian Westphal wrote: > Shaochun Chen points out we leak dumper filter state allocations > stored in dump_control->data in case there is an error before netlink sets > cb_running (after which ->done will be called at some point). > > In order to fix this, add .start functions and do the allocations > there. > > ->done is going to clean up, and in case error occurs before > ->start invocation no cleanups need to be done anymore. LGTM. Thanks Florian BTW, probably we can add cb->nla with strict typing instead, so we don't need to use cb->data. This cb->nla would be only valid from .start(). Then, set cb->nla to NULL after .start() is called. Just to make sure people don't make wrong assumptions and try to access this from the classic dump path? Just an idea.