aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMichal Miroslaw <mirq-linux@rere.qmqm.pl>2007-03-04 19:00:04 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-03-05 16:25:26 -0500
commitb4d6202b3652f5dbce358b99dee7d7c80b567529 (patch)
tree9aa929b69edf17b83e0225fd221cd27672c64705 /net
parent7d90e86d31e8beeb66d6754aece890ac4a579887 (diff)
[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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nfnetlink_log.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
index d0af8bc3eee1..91a0972ec117 100644
--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -218,6 +218,9 @@ _instance_destroy2(struct nfulnl_instance *inst, int lock)
218 218
219 spin_lock_bh(&inst->lock); 219 spin_lock_bh(&inst->lock);
220 if (inst->skb) { 220 if (inst->skb) {
221 /* timer "holds" one reference (we have one more) */
222 if (del_timer(&inst->timer))
223 instance_put(inst);
221 if (inst->qlen) 224 if (inst->qlen)
222 __nfulnl_send(inst); 225 __nfulnl_send(inst);
223 if (inst->skb) { 226 if (inst->skb) {
@@ -362,9 +365,6 @@ __nfulnl_send(struct nfulnl_instance *inst)
362{ 365{
363 int status; 366 int status;
364 367
365 if (timer_pending(&inst->timer))
366 del_timer(&inst->timer);
367
368 if (!inst->skb) 368 if (!inst->skb)
369 return 0; 369 return 0;
370 370
@@ -689,6 +689,9 @@ nfulnl_log_packet(unsigned int pf,
689 * enough room in the skb left. flush to userspace. */ 689 * enough room in the skb left. flush to userspace. */
690 UDEBUG("flushing old skb\n"); 690 UDEBUG("flushing old skb\n");
691 691
692 /* timer "holds" one reference (we have another one) */
693 if (del_timer(&inst->timer))
694 instance_put(inst);
692 __nfulnl_send(inst); 695 __nfulnl_send(inst);
693 696
694 if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) { 697 if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) {