All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Jack Satu Rumah Net <Jack@saturumah.net>
Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org
Subject: Re: [PATCH nf] netfilter: xt_nat: drop packet when conntrack is missing or invalid
Date: Fri, 27 Nov 2026 10:05:51 +0100	[thread overview]
Message-ID: <awlH7zpDVGHdlDv7@strlen.de> (raw)
In-Reply-To: <CALZdHNroZj41WOBd9g4+csZ91h_yEzHP496Sm_esQypv-mztVA@mail.gmail.com>

Jack Satu Rumah Net <Jack@saturumah.net> wrote:
> Hello Netfilter maintainers,
> 
> When an SNAT or DNAT target in net/netfilter/xt_nat.c processes a packet
> where nf_ct_get() returns NULL or ctinfo is outside the allowed states,
> WARN_ON() only logs a warning and still calls nf_nat_setup_info(),
> resulting in a NULL pointer dereference in nf_ct_net(ct).

> Drop the packet with NF_DROP after WARN_ON_ONCE() when conntrack is
> missing or ctinfo does not match the target's allowed states across
> SNAT and DNAT targets (v0, v1, v2).
> 
> Signed-off-by: Jack Satu Rumah Net <jack@saturumah.net>
> ---
> Observed on Linux v6.12.119 (commit
> e2e4b92c2b2a3ae78423cb343951cb5d2241b405)
> with CONFIG_NF_NAT=y when packets marked NOTRACK in the raw table hit a
> SNAT or DNAT rule.

You need to figure out why and how such packets end up in xt_nat
frontend code.

skb with no conntrack must not ever end up in nat frontend code
to begin with.

nf_nat_inet_fn() returns NF_ACCEPT if ct is NULL, so I have no idea
how what you describe can happen.

       reply	other threads:[~2026-11-27  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CALZdHNroZj41WOBd9g4+csZ91h_yEzHP496Sm_esQypv-mztVA@mail.gmail.com>
2026-11-27  9:05 ` Florian Westphal [this message]
2026-11-28 17:40   ` [PATCH nf] netfilter: xt_nat: drop packet when conntrack is missing or invalid jack

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=awlH7zpDVGHdlDv7@strlen.de \
    --to=fw@strlen.de \
    --cc=Jack@saturumah.net \
    --cc=coreteam@netfilter.org \
    --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 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.