Skip to contentSkip to conversation

nfnetlink_log: fix silly refcount leak

PATCH Applied Alexey Dobriyan 2 participants 2 messages Feb 24, 2010 – Feb 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfnetlink_log: fix silly refcount leak

Quick fix for memory/module refcount leak. Reference count of listener instance never reaches 0.

Start/stop of ulogd2 is enough to trigger this bug!

Now, refcounting there looks very fishy in particular this code:

 	if (!try_module_get(THIS_MODULE)) {
		...

and creation of listener instance with refcount 2, so it may very well be ripped and redone. :-)

---

 net/netfilter/nfnetlink_log.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nfnetlink_log.c +1 -1
@@ -784,7 +784,7 @@ nfulnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
 			}
 
 			instance_destroy(inst);
-			goto out;
+			goto out_put;
 		default:
 			ret = -ENOTSUPP;
 			break;
#1 lore raw
Quoted 5 lines · Alexey Dobriyan

Quick fix for memory/module refcount leak. Reference count of listener instance never reaches 0.

Start/stop of ulogd2 is enough to trigger this bug!

Quoted 7 lines

Now, refcounting there looks very fishy in particular this code:

 	if (!try_module_get(THIS_MODULE)) {
		...

and creation of listener instance with refcount 2, so it may very well be ripped and redone. :-)

Applied, thanks Alexey.