Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Jiayuan Chen <jiayuan.chen@linux.dev>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf] netfilter: nft_ct: fix OOB in NFT_CT_SRC/DST eval
Date: Thu, 28 May 2026 07:43:04 +0200	[thread overview]
Message-ID: <ahfV6K6KrG0akLUZ@strlen.de> (raw)
In-Reply-To: <ahfQGCNs8hl6FlHL@strlen.de>

Florian Westphal <fw@strlen.de> wrote:
> > which makes nf_ct_l3num(ct) be 0
> 
> How?

Wild guess:

diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c
--- a/net/netfilter/nft_ct.c
+++ b/net/netfilter/nft_ct.c
@@ -78,7 +78,7 @@ static void nft_ct_get_eval(const struct nft_expr *expr,
 		break;
 	}
 
-	if (ct == NULL)
+	if (!ct || nf_ct_is_template(ct))
 		goto err;
 
 	switch (priv->key) {
diff --git a/net/netfilter/nft_ct_fast.c b/net/netfilter/nft_ct_fast.c
--- a/net/netfilter/nft_ct_fast.c
+++ b/net/netfilter/nft_ct_fast.c
@@ -30,7 +30,7 @@ void nft_ct_get_fast_eval(const struct nft_expr *expr,
 		break;
 	}
 
-	if (!ct) {
+	if (!ct || nf_ct_is_template(ct)) {
 		regs->verdict.code = NFT_BREAK;
 		return;
 	}


.... might also make sense to invert
nf_ct_l3num(ct) == NFPROTO_IPV4 ? 4 : 16), i.e.:
nf_ct_l3num(ct) == NFPROTO_IPV6 ? 16 : 4);

  reply	other threads:[~2026-05-28  5:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  4:26 [PATCH nf] netfilter: nft_ct: fix OOB in NFT_CT_SRC/DST eval Jiayuan Chen
2026-05-28  5:19 ` Florian Westphal
2026-05-28  5:43   ` Florian Westphal [this message]
2026-05-28  7:02     ` Jiayuan Chen
2026-05-28  7:10       ` Florian Westphal
2026-05-28  7:27         ` Jiayuan Chen
2026-05-28  8:01           ` Florian Westphal
2026-05-28  8:25             ` Jiayuan Chen
2026-05-28  9:31               ` Florian Westphal
2026-05-28 10:03                 ` Pablo Neira Ayuso
2026-05-28 10:24                   ` Florian Westphal
2026-05-28 10:26                     ` Jiayuan Chen

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=ahfV6K6KrG0akLUZ@strlen.de \
    --to=fw@strlen.de \
    --cc=jiayuan.chen@linux.dev \
    --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