netfilter: ctnetlink: fix possible refcount leak in ctnetlink_create_conntrack()
[ Upstream commitac4893980b] 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:7d367e0668("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
9f7abdd500
commit
1ff0b87df9
@@ -2359,12 +2359,15 @@ ctnetlink_create_conntrack(struct net *net,
|
||||
|
||||
err = nf_conntrack_hash_check_insert(ct);
|
||||
if (err < 0)
|
||||
goto err2;
|
||||
goto err3;
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
return ct;
|
||||
|
||||
err3:
|
||||
if (ct->master)
|
||||
nf_ct_put(ct->master);
|
||||
err2:
|
||||
rcu_read_unlock();
|
||||
err1:
|
||||
|
||||
Reference in New Issue
Block a user