netfilter: nft_inner: always save the parsed tunnel context
Subsystems (2)
PATCH 1/1 netfilter: nft_inner: always save the parsed tunnel context
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 <[email protected]>
Assisted-by Claude:claude-opus-5-5
--- net/netfilter/nft_inner.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/netfilter/nft_inner.c +1 -2
@@ -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
Signature · 1 line
2.52.0