[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240425100410.GB29182@breakpoint.cc>
Date: Thu, 25 Apr 2024 12:04:10 +0200
From: Florian Westphal <fw@...len.de>
To: Eric Dumazet <edumazet@...gle.com>
Cc: Pablo Neira Ayuso <pablo@...filter.org>, linke li <lilinke99@...com>,
xujianhao01@...il.com, Jozsef Kadlecsik <kadlec@...filter.org>,
Florian Westphal <fw@...len.de>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
netfilter-devel@...r.kernel.org, coreteam@...filter.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] netfilter: mark racy access on ext->gen_id
Eric Dumazet <edumazet@...gle.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.
Powered by blists - more mailing lists