netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 09/10]: nfnetlink_log: fix reference counting
Date: Sun,  4 Mar 2007 21:20:10 +0100 (MET)	[thread overview]
Message-ID: <20070304201918.28582.61146.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070304201906.28582.51903.sendpatchset@localhost.localdomain>

[NETFILTER]: nfnetlink_log: fix reference counting

Fix reference counting (memory leak) problem in __nfulnl_send() and callers
related to packet queueing.

Signed-off-by: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 346efa9c7dd81bff762a436d0259424e7c74fa69
tree 70f56ee7946691f7326b9e8bb2d8bbb502c757e2
parent 3aed666579e96dfe23eb1988faf4af09c33358bc
author Michal Miroslaw <mirq-linux@rere.qmqm.pl> Fri, 02 Mar 2007 13:24:08 +0100
committer Patrick McHardy <kaber@trash.net> Fri, 02 Mar 2007 13:24:08 +0100

 net/netfilter/nfnetlink_log.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index d0af8bc..91a0972 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -218,6 +218,9 @@ _instance_destroy2(struct nfulnl_instanc
 
 	spin_lock_bh(&inst->lock);
 	if (inst->skb) {
+		/* timer "holds" one reference (we have one more) */
+		if (del_timer(&inst->timer))
+			instance_put(inst);
 		if (inst->qlen)
 			__nfulnl_send(inst);
 		if (inst->skb) {
@@ -362,9 +365,6 @@ __nfulnl_send(struct nfulnl_instance *in
 {
 	int status;
 
-	if (timer_pending(&inst->timer))
-		del_timer(&inst->timer);
-
 	if (!inst->skb)
 		return 0;
 
@@ -689,6 +689,9 @@ #endif
 		 * enough room in the skb left. flush to userspace. */
 		UDEBUG("flushing old skb\n");
 
+		/* timer "holds" one reference (we have another one) */
+		if (del_timer(&inst->timer))
+			instance_put(inst);
 		__nfulnl_send(inst);
 
 		if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) {

  parent reply	other threads:[~2007-03-04 20:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-04 20:19 [NETFILTER 00/10]: Netfilter fixes Patrick McHardy
2007-03-04 20:19 ` [NETFILTER 01/10]: conntrack: fix {nf, ip}_ct_iterate_cleanup endless loops Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 02/10]: nf_conntrack/nf_nat: fix incorrect config ifdefs Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 03/10]: tcp conntrack: accept SYN|URG as valid Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 04/10]: nfnetlink_log: fix reference leak Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 05/10]: nfnetlink_log: fix use after free Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 06/10]: nfnetlink_log: fix NULL pointer dereference Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 07/10]: nfnetlink_log: fix possible " Patrick McHardy
2007-03-04 20:20 ` [NETFILTER 08/10]: nfnetlink_log: fix module reference counting Patrick McHardy
2007-03-04 20:20 ` Patrick McHardy [this message]
2007-03-04 20:20 ` [NETFILTER 10/10]: ip6_route_me_harder should take into account mark Patrick McHardy
2007-03-05  0:00 ` [NETFILTER 00/10]: Netfilter fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070304201918.28582.61146.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).