[patch 06/31] NETFILTER: nfnetlink_log: fix reference counting

From: Greg KH
Date: Mon Mar 19 2007 - 17:41:09 EST


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

------------------

From: Michal Miroslaw <mirq-linux@xxxxxxxxxxxx>

[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@xxxxxxxxxxxx>
Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
net/netfilter/nfnetlink_log.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

--- a/net/netfilter/nfnetlink_log.c
+++ b/net/netfilter/nfnetlink_log.c
@@ -218,10 +218,8 @@ _instance_destroy2(struct nfulnl_instanc
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);
+ if (del_timer(&inst->timer))
instance_put(inst);
- }
if (inst->qlen)
__nfulnl_send(inst);
if (inst->skb) {
@@ -695,10 +693,8 @@ nfulnl_log_packet(unsigned int pf,
UDEBUG("flushing old skb\n");

/* timer "holds" one reference (we have another one) */
- if (timer_pending(&inst->timer)) {
- del_timer(&inst->timer);
+ if (del_timer(&inst->timer))
instance_put(inst);
- }
__nfulnl_send(inst);

if (!(inst->skb = nfulnl_alloc_skb(nlbufsiz, size))) {

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/