From: Vlad Buslov <vladbu@nvidia.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"David Miller" <davem@davemloft.net>,
"Jamal Hadi Salim" <jhs@mojatatu.com>,
"Jiri Pirko" <jiri@resnulli.us>,
"Jakub Kicinski" <kuba@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"Linux Kernel Network Developers" <netdev@vger.kernel.org>,
"Toke Høiland-Jørgensen" <toke@redhat.com>
Subject: Re: [PATCH v2 1/1] net: sched: bump refcount for new action in ACT replace mode
Date: Wed, 31 Mar 2021 10:59:37 +0300 [thread overview]
Message-ID: <ygnh8s63hhxy.fsf@nvidia.com> (raw)
In-Reply-To: <CAM_iQpVAo+Zxus-FC59xzwcmbS7UOi6F8kNMzsrEVrBY2YRtNA@mail.gmail.com>
On Wed 31 Mar 2021 at 07:40, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> On Mon, Mar 29, 2021 at 3:55 PM Kumar Kartikeya Dwivedi
> <memxor@gmail.com> wrote:
>> diff --git a/net/sched/act_api.c b/net/sched/act_api.c
>> index b919826939e0..43cceb924976 100644
>> --- a/net/sched/act_api.c
>> +++ b/net/sched/act_api.c
>> @@ -1042,6 +1042,9 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
>> if (err != ACT_P_CREATED)
>> module_put(a_o->owner);
>>
>> + if (!bind && ovr && err == ACT_P_CREATED)
>> + refcount_set(&a->tcfa_refcnt, 2);
>> +
>
> Hmm, if we set the refcnt to 2 here, how could tcf_action_destroy()
> destroy them when we rollback from a failure in the middle of the loop
> in tcf_action_init()?
>
> Thanks.
Hmm, you might be right. Also, the error handling code in
tcf_action_init() looks incorrect:
err:
tcf_action_destroy(actions, bind);
err_mod:
for (i = 0; i < TCA_ACT_MAX_PRIO; i++) {
if (ops[i])
module_put(ops[i]->owner);
}
return err;
It looks like here the modules for all actions that successfully
completed their init has already been release by either
tcf_action_init_1() on action overwrite or by tcf_action_destroy() on
action create. I'll try to come up with tests that validate these corner
cases.
Regards,
Vlad
next prev parent reply other threads:[~2021-03-31 8:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-29 22:53 [PATCH v2 1/1] net: sched: bump refcount for new action in ACT replace mode Kumar Kartikeya Dwivedi
2021-03-30 10:32 ` Vlad Buslov
2021-03-30 10:41 ` [PATCH net-next] tc-testing: add simple action change test Vlad Buslov
2021-03-31 0:20 ` patchwork-bot+netdevbpf
2021-03-31 4:40 ` [PATCH v2 1/1] net: sched: bump refcount for new action in ACT replace mode Cong Wang
2021-03-31 7:59 ` Vlad Buslov [this message]
2021-03-31 8:37 ` [PATCH net-next v3] " Kumar Kartikeya Dwivedi
2021-03-31 14:08 ` Vlad Buslov
2021-03-31 8:38 ` [PATCH v2 1/1] " Kumar Kartikeya Dwivedi
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=ygnh8s63hhxy.fsf@nvidia.com \
--to=vladbu@nvidia.com \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=toke@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox