Netfilter-Devel Archive mirror
 help / color / mirror / Atom feed
From: "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>
To: Florian Westphal <fw@strlen.de>
Cc: <pablo@netfilter.org>, <kadlec@netfilter.org>,
	<netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nft v2] netfilter: nf_tables: Fix pertential data-race in __nft_flowtable_type_get()
Date: Wed, 3 Apr 2024 16:30:41 +0800	[thread overview]
Message-ID: <0a1e576a-7fb8-8f26-17ce-54ec137acf70@huawei.com> (raw)
In-Reply-To: <20240403080144.GC26310@breakpoint.cc>

> Ziyang Xuan <william.xuanziyang@huawei.com> wrote:
>> nft_unregister_flowtable_type() within nf_flow_inet_module_exit() can
>> concurrent with __nft_flowtable_type_get() within nf_tables_newflowtable().
>> And thhere is not any protection when iterate over nf_tables_flowtables
>> list in __nft_flowtable_type_get(). Therefore, there is pertential
>> data-race of nf_tables_flowtables list entry.
>>
>> Use list_for_each_entry_rcu() to iterate over nf_tables_flowtables list
>> in __nft_flowtable_type_get(), and use rcu_read_lock() in the caller
>> nft_flowtable_type_get() to protect the entire type query process.
> 
> Reviewed-by: Florian Westphal <fw@strlen.de>
> 
> Would you be so kind to send followup patches for the other two types
> Pablo pointed out?
> 
> static LIST_HEAD(nf_tables_expressions);
> static LIST_HEAD(nf_tables_objects);
> 
> It looks like they have same issue.

Yes, I am doing and testing.

Best regards.
> 
> Thanks!
> 
> 
> .
> 

      reply	other threads:[~2024-04-03  8:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-03  7:22 [PATCH nft v2] netfilter: nf_tables: Fix pertential data-race in __nft_flowtable_type_get() Ziyang Xuan
2024-04-03  8:01 ` Florian Westphal
2024-04-03  8:30   ` Ziyang Xuan (William) [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=0a1e576a-7fb8-8f26-17ce-54ec137acf70@huawei.com \
    --to=william.xuanziyang@huawei.com \
    --cc=fw@strlen.de \
    --cc=kadlec@netfilter.org \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).