Re: [PATCH v2] netfilter: ctmark: Fix data-races around ctmark

From: Pablo Neira Ayuso
Date: Fri Nov 18 2022 - 05:29:34 EST


On Wed, Nov 09, 2022 at 12:39:07PM -0700, Daniel Xu wrote:
> nf_conn:mark can be read from and written to in parallel. Use
> READ_ONCE()/WRITE_ONCE() for reads and writes to prevent unwanted
> compiler optimizations.
>
> Signed-off-by: Daniel Xu <dxu@xxxxxxxxx>
> ---
> Changes since v1:
> - Remove WRITE_ONCE() from init path
>
> net/core/flow_dissector.c | 2 +-
> net/ipv4/netfilter/ipt_CLUSTERIP.c | 4 ++--
> net/netfilter/nf_conntrack_core.c | 2 +-
> net/netfilter/nf_conntrack_netlink.c | 24 ++++++++++++++----------
> net/netfilter/nf_conntrack_standalone.c | 2 +-
> net/netfilter/nft_ct.c | 6 +++---
> net/netfilter/xt_connmark.c | 18 ++++++++++--------
> net/openvswitch/conntrack.c | 8 ++++----
> net/sched/act_connmark.c | 4 ++--
> net/sched/act_ct.c | 8 ++++----
> net/sched/act_ctinfo.c | 6 +++---
> 11 files changed, 45 insertions(+), 39 deletions(-)

I am going to place this in nf.git, it's a bit late but it's
relatively small and I think the sooner the better to have this fix.