From: Greg KH Subject: [patch 04/20] nfnetlink_log: fix reference leak Date: Fri, 9 Mar 2007 22:17:01 -0800 Message-ID: <20070310061701.GE31412@kroah.com> References: <20070310061234.465093436@mini.kroah.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Theodore Ts'o , Zwane Mwaikambo , netfilter-devel@lists.netfilter.org, Justin Forbes , Chris Wedgwood , davem@davemloft.net, Randy Dunlap , Michael Krufky , Chuck Ebbert , Dave Jones , Chuck Wolber , akpm@linux-foundation.org, Michal Miroslaw , torvalds@linux-foundation.org, Patrick McHardy , alan@lxorguk.ukuu.org.uk To: linux-kernel@vger.kernel.org, stable@kernel.org Return-path: Content-Disposition: inline; filename="nfnetlink_log-fix-reference-leak.patch" In-Reply-To: <20070310061603.GA31412@kroah.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org -stable review patch. If anyone has any objections, please let us know. ------------------ From: Patrick McHardy [NETFILTER]: nfnetlink_log: fix reference leak Stop reference leaking in nfulnl_log_packet(). If we start a timer we are already taking another reference. Signed-off-by: Michal Miroslaw Signed-off-by: Patrick McHardy Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nfnetlink_log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -720,15 +720,16 @@ nfulnl_log_packet(unsigned int pf, inst->timer.expires = jiffies + (inst->flushtimeout*HZ/100); add_timer(&inst->timer); } - spin_unlock_bh(&inst->lock); +unlock_and_release: + spin_unlock_bh(&inst->lock); + instance_put(inst); return; alloc_failure: - spin_unlock_bh(&inst->lock); - instance_put(inst); UDEBUG("error allocating skb\n"); /* FIXME: statistics */ + goto unlock_and_release; } static int --