Skip to content

Commit 709f6c7

Browse files
committed
netfilter: ctnetlink: fix possible refcount leak in ctnetlink_create_conntrack()
jira VULN-6817 cve CVE-2023-7192 commit-author Hangyu Hua <hbh25y@gmail.com> commit ac48939 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 <hbh25y@gmail.com> Acked-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit ac48939) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent 75e19ce commit 709f6c7

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)