From: Cong Wang <xiyou.wangcong@gmail.com>
To: Hangyu Hua <hbh25y@gmail.com>
Cc: jhs@mojatatu.com, jiri@resnulli.us, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
paulb@mellanox.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: sched: act_ct: fix possible refcount leak in tcf_ct_init()
Date: Sat, 1 Oct 2022 12:55:37 -0700 [thread overview]
Message-ID: <YzibOQ2dviUNneAY@pop-os.localdomain> (raw)
In-Reply-To: <20220923020046.8021-1-hbh25y@gmail.com>
On Fri, Sep 23, 2022 at 10:00:46AM +0800, Hangyu Hua wrote:
> 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>
> ---
>
> v2: use a new label to put the refcount.
>
> net/sched/act_ct.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
> index d55afb8d14be..5950974ae8f6 100644
> --- a/net/sched/act_ct.c
> +++ b/net/sched/act_ct.c
> @@ -1394,7 +1394,7 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
>
> err = tcf_ct_flow_table_get(net, params);
> if (err)
> - goto cleanup;
> + goto cleanup_params;
>
> spin_lock_bh(&c->tcf_lock);
> goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
> @@ -1409,6 +1409,9 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
>
> return res;
>
> +cleanup_params:
> + if (params->tmpl)
> + nf_ct_put(params->tmpl);
Nit: this NULL check is unnecessary.
Thanks.
prev parent reply other threads:[~2022-10-01 19:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-23 2:00 [PATCH net v2] net: sched: act_ct: fix possible refcount leak in tcf_ct_init() Hangyu Hua
2022-09-26 19:50 ` patchwork-bot+netdevbpf
2022-10-01 19:55 ` Cong Wang [this message]
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=YzibOQ2dviUNneAY@pop-os.localdomain \
--to=xiyou.wangcong@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hbh25y@gmail.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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox