From: Florian Westphal <fw@strlen•de>
To: Eric Dumazet <edumazet@google•com>
Cc: Pablo Neira Ayuso <pablo@netfilter•org>,
linke li <lilinke99@qq•com>,
xujianhao01@gmail•com, Jozsef Kadlecsik <kadlec@netfilter•org>,
Florian Westphal <fw@strlen•de>,
"David S. Miller" <davem@davemloft•net>,
Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
netfilter-devel@vger•kernel.org, coreteam@netfilter•org,
netdev@vger•kernel.org, linux-kernel@vger•kernel.org
Subject: Re: [PATCH] netfilter: mark racy access on ext->gen_id
Date: Thu, 25 Apr 2024 12:04:10 +0200 [thread overview]
Message-ID: <20240425100410.GB29182@breakpoint.cc> (raw)
In-Reply-To: <CANn89iLxRgYSsFokDo327B4CwwwN9B1Q8e+OHvQenn0a5SfxDQ@mail.gmail.com>
Eric Dumazet <edumazet@google•com> wrote:
> > There are a more uses ext->gen_id in the code, my understanding this
> > patch is just a stub.
>
> Anyway, ext->gen_id was already read and stored in @this_id
>
> I would probably avoid reading it a second time.
> diff --git a/net/netfilter/nf_conntrack_extend.c
> b/net/netfilter/nf_conntrack_extend.c
> index dd62cc12e7750734fec9be8a90fd0defcbc815e0..747797b20bc7417a2b7270d84f62d24991a4b982
> 100644
> --- a/net/netfilter/nf_conntrack_extend.c
> +++ b/net/netfilter/nf_conntrack_extend.c
> @@ -141,7 +141,7 @@ void *__nf_ct_ext_find(const struct nf_ct_ext *ext, u8 id)
> if (!__nf_ct_ext_exist(ext, id))
> return NULL;
>
> - if (this_id == 0 || ext->gen_id == gen_id)
> + if (this_id == 0 || this_id == gen_id)
> return (void *)ext + ext->offset[id];
>
> return NULL;
>
Right, that should work, unconfirmed entries are not exposed to other
cpus and confirmed entries get their id set to 0.
prev parent reply other threads:[~2024-04-25 10:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-23 11:50 [PATCH] netfilter: mark racy access on ext->gen_id linke li
2024-04-23 12:03 ` Florian Westphal
2024-04-24 22:20 ` Pablo Neira Ayuso
2024-04-25 9:36 ` Pablo Neira Ayuso
2024-04-25 9:54 ` Eric Dumazet
2024-04-25 10:04 ` Florian Westphal [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=20240425100410.GB29182@breakpoint.cc \
--to=fw@strlen$(echo .)de \
--cc=coreteam@netfilter$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=edumazet@google$(echo .)com \
--cc=kadlec@netfilter$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=lilinke99@qq$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=netfilter-devel@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=pablo@netfilter$(echo .)org \
--cc=xujianhao01@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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