[patch 04/20] nfnetlink_log: fix reference leak

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg KH
Date: Friday, March 9, 2007 - 11:17 pm

-stable review patch.  If anyone has any objections, please let us know.

------------------
From: Patrick McHardy <kaber@trash.net>

[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 <mirq-linux@rere.qmqm.pl>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


---
 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

-- 
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 00/20] 2.6.20-stable review, Greg KH, (Fri Mar 9, 11:16 pm)
[patch 04/20] nfnetlink_log: fix reference leak, Greg KH, (Fri Mar 9, 11:17 pm)
[patch 05/20] nfnetlink_log: fix use after free, Greg KH, (Fri Mar 9, 11:17 pm)
[patch 15/20] Fix compat_getsockopt, Greg KH, (Fri Mar 9, 11:18 pm)
[patch 17/20] Fix callback bug in connector, Greg KH, (Fri Mar 9, 11:18 pm)
[patch 19/20] Fix timewait jiffies, Greg KH, (Fri Mar 9, 11:18 pm)
Re: [patch 00/20] 2.6.20-stable review, Greg KH, (Fri Mar 9, 11:23 pm)
Re: [patch 00/20] 2.6.20-stable review, Chuck Ebbert, (Sat Mar 10, 2:43 pm)
Re: [patch 00/20] 2.6.20-stable review, Greg KH, (Sat Mar 10, 2:49 pm)