netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Quan Tian <tianquan23@gmail.com>
Cc: netfilter-devel@vger.kernel.org, pablo@netfilter.org,
	kadlec@netfilter.org, fw@strlen.de
Subject: Re: [PATCH v3 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store userdata for nft_table
Date: Tue, 12 Mar 2024 15:05:35 +0100	[thread overview]
Message-ID: <20240312140535.GC1529@breakpoint.cc> (raw)
In-Reply-To: <20240311141454.31537-1-tianquan23@gmail.com>

Quan Tian <tianquan23@gmail.com> wrote:
>  	u32				nlpid;
>  	char				*name;
> -	u16				udlen;
> -	u8				*udata;
> +	struct nlattr			*udata;

I missed this detail.  As Pablo pointed out this pointer
now needs a __rcu annotation.

And this needs something like:

struct nlattr *udata = rcu_dereference(table->udata);

if (udata) {
 	if (nla_put(skb, NFTA_TABLE_USERDATA, nla_len(udata), nla_data(udata)))

> +		if (nla_put(skb, NFTA_TABLE_USERDATA, nla_len(table->udata),
> +			    nla_data(table->udata)))

... because this version can observe different table->udata for
nla_len() and nla_data() calls if the swap() has the "right" / "wrong"
timing.

  parent reply	other threads:[~2024-03-12 14:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 14:14 [PATCH v3 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store userdata for nft_table Quan Tian
2024-03-11 14:14 ` [PATCH v3 nf-next 2/2] netfilter: nf_tables: support updating " Quan Tian
2024-03-12 12:27   ` Florian Westphal
2024-03-12 12:49     ` Pablo Neira Ayuso
2024-03-12 13:01       ` Florian Westphal
2024-03-12 14:26         ` Quan Tian
2024-03-12 14:33           ` Florian Westphal
2024-03-12 22:23             ` Pablo Neira Ayuso
2024-03-13  1:35               ` Quan Tian
2024-03-13  9:40                 ` Pablo Neira Ayuso
2024-03-13 17:08                   ` Quan Tian
2024-03-12 14:36           ` Pablo Neira Ayuso
2024-03-12 13:49   ` Pablo Neira Ayuso
2024-03-12 14:02     ` Florian Westphal
2024-03-12 14:10   ` Florian Westphal
2024-03-12 14:30     ` Quan Tian
2024-03-12 14:05 ` Florian Westphal [this message]
2024-03-12 14:17   ` [PATCH v3 nf-next 1/2] netfilter: nf_tables: use struct nlattr * to store " Pablo Neira Ayuso
2024-03-12 14:34     ` Florian Westphal
2024-03-12 15:03       ` Quan Tian

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=20240312140535.GC1529@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=kadlec@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=tianquan23@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;
as well as URLs for NNTP newsgroup(s).