From: wenxu <wenxu@ucloud.cn>
To: Florian Westphal <fw@strlen.de>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next] netfilter: nf_table_offload: Fix the incorrect rcu usage in nft_indr_block_get_and_ing_cmd
Date: Mon, 19 Aug 2019 18:48:46 +0800 [thread overview]
Message-ID: <2bde486e-dfe8-ad2b-8b77-babcad90d82e@ucloud.cn> (raw)
In-Reply-To: <20190819102123.GA2588@breakpoint.cc>
On 8/19/2019 6:21 PM, Florian Westphal wrote:
> wenxu@ucloud.cn <wenxu@ucloud.cn> wrote:
>> From: wenxu <wenxu@ucloud.cn>
>>
>> The nft_indr_block_get_and_ing_cmd is called in netdevice notify
>> It is the incorrect rcu case, To fix it just traverse the list under
>> the commit mutex.
> What is an 'incorrect rcu case'?
>
> Please clarify, e.g. by including rcu warning/splat backtrace here.
according to http://patchwork.ozlabs.org/patch/1148283/
flow_block_ing_cmd() needs to call blocking functions while iterating block_ing_cb_list,
nft_indr_block_get_and_ing_cmd is in the cb_list, So it should also not in rcu for blocking
cases.
>
>> + struct nft_ctx ctx = {
>> + .net = dev_net(dev),
>> + };
> Why is this ctx needed?
>
>> + mutex_lock(&ctx.net->nft.commit_mutex);
> net->nft.commit_mutex?
When traverse the list, the list is protected under commit_mutex like nf_tables_netdev_event
do in the netdevice notify callback
>
>> - list_for_each_entry_rcu(chain, &table->chains, list) {
>> + list_for_each_entry_safe(chain, nr, &table->chains, list) {
> Why is _safe needed rather than list_for_each_entry()?
yes list_for_each_entry() is better
>
next prev parent reply other threads:[~2019-08-19 10:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-19 9:46 [PATCH nf-next] netfilter: nf_table_offload: Fix the incorrect rcu usage in nft_indr_block_get_and_ing_cmd wenxu
2019-08-19 10:21 ` Florian Westphal
2019-08-19 10:48 ` wenxu [this message]
2019-08-19 10:59 ` Florian Westphal
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=2bde486e-dfe8-ad2b-8b77-babcad90d82e@ucloud.cn \
--to=wenxu@ucloud.cn \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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;
as well as URLs for NNTP newsgroup(s).