Commit ac489398 authored by Hangyu Hua's avatar Hangyu Hua Committed by Pablo Neira Ayuso

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: 7d367e06 ("netfilter: ctnetlink: fix soft lockup when netlink adds new entries (v2)")
Signed-off-by: default avatarHangyu Hua <hbh25y@gmail.com>
Acked-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 92f3e96d
...@@ -2375,12 +2375,15 @@ ctnetlink_create_conntrack(struct net *net, ...@@ -2375,12 +2375,15 @@ ctnetlink_create_conntrack(struct net *net,
err = nf_conntrack_hash_check_insert(ct); err = nf_conntrack_hash_check_insert(ct);
if (err < 0) if (err < 0)
goto err2; goto err3;
rcu_read_unlock(); rcu_read_unlock();
return ct; return ct;
err3:
if (ct->master)
nf_ct_put(ct->master);
err2: err2:
rcu_read_unlock(); rcu_read_unlock();
err1: err1:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment