diff options
author | MichaÅ MirosÅaw <mirq-linux@rere.qmqm.pl> | 2007-03-09 10:50:27 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-03-09 10:50:27 -0800 |
commit | 9b1e918ac5dfc73493a2253731ab84a7f907c5be (patch) | |
tree | dc63b880bd8dcafe062123a7ed28756a58dde8d4 /net | |
parent | 9e44f708876955f49190c04ce83b9dcb712ce3ff (diff) |
Fix reference counting (memory leak) problem in __nfulnl_send() and callers related to packet queueing.
Signed-off-by: MichaÅ MirosÅaw <mirq-linux@rere.qmqm.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index d1505dd25c66..24c1d29e4283 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c @@ -217,6 +217,11 @@ _instance_destroy2(struct nfulnl_instance *inst, int lock) spin_lock_bh(&inst->lock); if (inst->skb) { + /* timer "holds" one reference (we have one more) */ + if (timer_pending(&inst->timer)) { + del_timer(&inst->timer); + instance_put(inst); + } if (inst->qlen) __nfulnl_send(inst); if (inst->skb) { @@ -363,9 +368,6 @@ __nfulnl_send(struct nfulnl_instance *inst) { int status; - if (timer_pending(&inst->timer)) - del_timer(&inst->timer); - if (!inst->skb) return 0; @@ -392,6 +394,8 @@ static void nfulnl_timer(unsigned long data) UDEBUG("timer function called, flushing buffer\n"); spin_lock_bh(&inst->lock); + if (timer_pending(&inst->timer)) /* is it always true or false here? */ + del_timer(&inst->timer); __nfulnl_send(inst); instance_put(inst); spin_unlock_bh(&inst->lock); @@ -689,6 +693,11 @@ nfulnl_log_packet(unsigned int pf, * enough room in the skb left. flush to userspace. */ UDEBUG("flushing old skb\n"); + /* timer "holds" one reference (we have another one) */ + if (timer_pending(&inst->timer)) { + del_timer(&inst->timer); + instance_put(inst); + } __nfulnl_send(inst); if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) { |