Skip to content

Commit ac48939

Browse files
HBh25Yummakynes
authored andcommitted
netfilter: ctnetlink: fix possible refcount leak in ctnetlink_create_conntrack()
nf_ct_put() needs to be called to put the refcount got by nf_conntrack_find_get() to avoid refcount leak when nf_conntrack_hash_check_insert() fails. Fixes: 7d367e0 ("netfilter: ctnetlink: fix soft lockup when netlink adds new entries (v2)") Signed-off-by: Hangyu Hua <[email protected]> Acked-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 92f3e96 commit ac48939

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

net/netfilter/nf_conntrack_netlink.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2375,12 +2375,15 @@ ctnetlink_create_conntrack(struct net *net,
23752375

23762376
err = nf_conntrack_hash_check_insert(ct);
23772377
if (err < 0)
2378-
goto err2;
2378+
goto err3;
23792379

23802380
rcu_read_unlock();
23812381

23822382
return ct;
23832383

2384+
err3:
2385+
if (ct->master)
2386+
nf_ct_put(ct->master);
23842387
err2:
23852388
rcu_read_unlock();
23862389
err1:

0 commit comments

Comments
 (0)