All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nf PATCH v3] netfilter: nfnetlink: Fix for interrupted hook dumps
Date: Mon, 7 Sep 2026 20:19:47 +0200	[thread overview]
Message-ID: <ap8AQ1DCUET8Ggkd@chamomile> (raw)
In-Reply-To: <20260904125215.1272252-1-phil@nwl.cc>

Hi Phil,

On Fri, Sep 04, 2026 at 02:52:15PM +0200, Phil Sutter wrote:
> @@ -338,27 +337,47 @@ nfnl_hook_entries_head(u8 pf, unsigned int hook, struct net *net, const char *de
>  }
>  
>  static int nfnl_hook_dump_nat(struct sk_buff *nlskb,
> -			      const struct nfnl_dump_hook_data *ctx,
> -			      const struct nf_hook_ops *ops,
> -			      int family, unsigned int seq)
> +			      struct netlink_callback *cb,
> +			      const struct nf_hook_ops *ops, int family)
>  {
>  	struct nf_nat_lookup_hook_priv *priv = ops->priv;
> -	struct nf_hook_entries *e = rcu_dereference(priv->entries);
> +	struct nfnl_dump_hook_data *ctx = cb->data;
> +	struct net *net = sock_net(nlskb->sk);
>  	struct nf_hook_ops **nat_ops;
> -	int i, err;
> +	unsigned int i = cb->args[1];
> +	struct nf_hook_entries *e;
> +	unsigned int base_seq;
> +	int err = 0;
>  
> +	base_seq = smp_load_acquire(&net->nf.nat_hook_base_seq);

Maybe annnotate this base sequence in the .start via:

struct netlink_dump_control c = {
        .start = ...;

We should probably start doing this in other nfnetlink subsystems too.

This will help catch an interference between two netlink recv() calls
which results in calling netlink_dump() which calls this function.

Let me know, thanks!

  reply	other threads:[~2026-09-07 18:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 12:52 [nf PATCH v3] netfilter: nfnetlink: Fix for interrupted hook dumps Phil Sutter
2026-09-07 18:19 ` Pablo Neira Ayuso [this message]
2026-09-08  9:23   ` Phil Sutter
2026-09-08 12:41     ` Pablo Neira Ayuso
2026-09-08 13:57       ` Phil Sutter
2026-09-09  0:34         ` Pablo Neira Ayuso

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=ap8AQ1DCUET8Ggkd@chamomile \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.