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

From: Florian Westphal
Date: Wed Nov 09 2022 - 13:09:13 EST


Daniel Xu <dxu@xxxxxxxxx> wrote:
> index f97bda06d2a9..669561fb73bd 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -1781,7 +1781,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
> }
>
> #ifdef CONFIG_NF_CONNTRACK_MARK
> - ct->mark = exp->master->mark;
> + WRITE_ONCE(ct->mark, READ_ONCE(exp->master->mark));

*ct is owned by the current cpu at this point, so WRITE_ONCE is not
needed.

Rest looks fine.