]> git.hungrycats.org Git - linux/commit
netfilter: flowtable: Validate iph->ihl in nf_flow_ip4_tunnel_proto()
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 8 Jun 2026 12:33:23 +0000 (14:33 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 23 Jun 2026 06:11:21 +0000 (08:11 +0200)
commit84460b644329e25809b4a6d9279d6359d7fd8ebc
treee82ab95468cdf8b9c798b9ad1175253dee310870
parentc8b6f36f766991e3ebebec6596daee4b04dcbc49
netfilter: flowtable: Validate iph->ihl in nf_flow_ip4_tunnel_proto()

Add sanity check for iph->ihl field in nf_flow_ip4_tunnel_proto() before
using it to compute the header size, avoiding out-of-bounds access with
malformed IP headers.
While at it, use iph->protocol instead of the hardcoded IPPROTO_IPIP
constant when setting ctx->tun.proto and reference ctx->tun.hdr_size
when updating ctx->offset.

Fixes: ab427db178858 ("netfilter: flowtable: Add IPIP rx sw acceleration")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_flow_table_ip.c