Linux Netfilter development
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf] netfilter: fix possible bug_on with enable_hooks=1
Date: Wed, 10 May 2023 08:33:14 +0200	[thread overview]
Message-ID: <ZFs6qpQB8rfK0kPd@calendula> (raw)
In-Reply-To: <20230504125502.22512-1-fw@strlen.de>

On Thu, May 04, 2023 at 02:55:02PM +0200, Florian Westphal wrote:
> I received a bug report (no reproducer so far) where we trip over
> 
> 712         rcu_read_lock();
> 713         ct_hook = rcu_dereference(nf_ct_hook);
> 714         BUG_ON(ct_hook == NULL);  // here
> 
> In nf_conntrack_destroy().
> 
> First turn this BUG_ON into a WARN.  I think it was triggered
> via enable_hooks=1 flag.
> 
> When this flag is turned on, the conntrack hooks are registered
> before nf_ct_hook pointer gets assigned.
> This opens a short window where packets enter the conntrack machinery,
> can have skb->_nfct set up and a subsequent kfree_skb might occur
> before nf_ct_hook is set.
> 
> Call nf_conntrack_init_end() to set nf_ct_hook before we register the
> pernet ops.

Applied to nf, thanks

      reply	other threads:[~2023-05-10  6:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 12:55 [PATCH nf] netfilter: fix possible bug_on with enable_hooks=1 Florian Westphal
2023-05-10  6:33 ` Pablo Neira Ayuso [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=ZFs6qpQB8rfK0kPd@calendula \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox