[NETFILTER]: nfnetlink_log: fix module reference counting
authorPatrick McHardy <kaber@trash.net>
Sun, 4 Mar 2007 23:59:45 +0000 (15:59 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 5 Mar 2007 21:25:25 +0000 (13:25 -0800)
Count module references correctly: after instance_destroy() there
might be timer pending and holding a reference for this netlink instance.

Based on patch 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>
net/netfilter/nfnetlink_log.c

index b669db5..d0af8bc 100644 (file)
@@ -133,6 +133,7 @@ instance_put(struct nfulnl_instance *inst)
        if (inst && atomic_dec_and_test(&inst->use)) {
                UDEBUG("kfree(inst=%p)\n", inst);
                kfree(inst);
+               module_put(THIS_MODULE);
        }
 }
 
@@ -228,8 +229,6 @@ _instance_destroy2(struct nfulnl_instance *inst, int lock)
 
        /* and finally put the refcount */
        instance_put(inst);
-
-       module_put(THIS_MODULE);
 }
 
 static inline void