mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tamaki Yanagawa <ty@000ty.net>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org, fw@strlen.de, phil@nwl.cc,
	coreteam@netfilter.org, linux-kernel@vger.kernel.org,
	ty@000ty.net
Subject: [PATCH nf] netfilter: nft_inner: always save the parsed tunnel context
Date: Sat, 07 Nov 2026 16:03:57 +0000	[thread overview]
Message-ID: <20261107160350.1359-1-ty@000ty.net> (raw)

nft_inner_save_tun_ctx() only updates the per-cpu tunnel context when
its cookie differs from the skb being evaluated. The cookie is the skb
address, so once an skb is freed and its address is reused by the next
packet on that cpu, the context parsed for the new packet is never
stored, and every following inner expression in the chain restores the
offsets and protocols of the previous packet instead. A tunnelled
packet can then be matched against another packet's headers, e.g. a
"vxlan tcp dport 22 drop" rule misses a packet whose inner IP header
length differs from the one before it. Store the context
unconditionally.

Fixes: 7b1d83da254b ("netfilter: nft_inner: incorrect percpu area handling under softirq")
Signed-off-by: Tamaki Yanagawa <ty@000ty.net>
Assisted-by: Claude:claude-opus-5-5
---
 net/netfilter/nft_inner.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/netfilter/nft_inner.c b/net/netfilter/nft_inner.c
index 97fb4eea2d..3af5ddd5ff 100644
--- a/net/netfilter/nft_inner.c
+++ b/net/netfilter/nft_inner.c
@@ -265,8 +265,7 @@ static void nft_inner_save_tun_ctx(const struct nft_pktinfo *pkt,
 	local_bh_disable();
 	local_lock_nested_bh(&nft_pcpu_tun_ctx.bh_lock);
 	this_cpu_tun_ctx = this_cpu_ptr(&nft_pcpu_tun_ctx.ctx);
-	if (this_cpu_tun_ctx->cookie != tun_ctx->cookie)
-		*this_cpu_tun_ctx = *tun_ctx;
+	*this_cpu_tun_ctx = *tun_ctx;
 	local_unlock_nested_bh(&nft_pcpu_tun_ctx.bh_lock);
 	local_bh_enable();
 }

base-commit: 734bef548a96e8774d6eef5dfa2026c6edc4e80b
-- 
2.52.0



                 reply	other threads:[~2026-11-07 16:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261107160350.1359-1-ty@000ty.net \
    --to=ty@000ty.net \
    --cc=coreteam@netfilter.org \
    --cc=fw@strlen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®