From: Hangyu Hua <hbh25y@gmail.com>
To: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, paulb@mellanox.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Hangyu Hua <hbh25y@gmail.com>
Subject: [PATCH] net: sched: act_ct: fix possible refcount leak in tcf_ct_init()
Date: Wed, 21 Sep 2022 17:06:00 +0800 [thread overview]
Message-ID: <20220921090600.29673-1-hbh25y@gmail.com> (raw)
nf_ct_put need to be called to put the refcount got by tcf_ct_fill_params
to avoid possible refcount leak when tcf_ct_flow_table_get fails.
Fixes: c34b961a2492 ("net/sched: act_ct: Create nf flow table per zone")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
net/sched/act_ct.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index d55afb8d14be..3646956fc717 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -1412,6 +1412,8 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
cleanup:
if (goto_ch)
tcf_chain_put_by_act(goto_ch);
+ if (params->tmpl)
+ nf_ct_put(params->tmpl);
kfree(params);
tcf_idr_release(*a, bind);
return err;
--
2.34.1
next reply other threads:[~2022-09-21 9:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-21 9:06 Hangyu Hua [this message]
2022-09-22 14:14 ` [PATCH] net: sched: act_ct: fix possible refcount leak in tcf_ct_init() Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220921090600.29673-1-hbh25y@gmail.com \
--to=hbh25y@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paulb@mellanox.com \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.