]> git.ipfire.org Git - thirdparty/linux.git/commit
tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()
authorEric Dumazet <edumazet@google.com>
Mon, 25 May 2026 20:13:35 +0000 (20:13 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 27 May 2026 01:10:25 +0000 (18:10 -0700)
commitb4bc94353050b1fa7b702bd4c6600710dd926cff
tree733ca2ad2496f37626eda800456268b2067cfc5a
parentd895767c337814cf4b97d5ad5375e5ed7e12018d
tunnels: load network headers after skb_cow() in iptunnel_pmtud_build_icmp[v6]()

Sashiko found that iptunnel_pmtud_build_icmp() and
iptunnel_pmtud_build_icmpv6() were caching ip_hdr() and ipv6_hdr()
before an skb_cow() call which can reallocate skb->head.

Fix this possible UAF by initializing the local variables
after the skb_cow() call.

Remove skb_reset_network_header() calls which were not needed.

Fixes: 4cb47a8644cc ("tunnels: PMTU discovery support for directly bridged IP packets")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
Link: https://patch.msgid.link/20260525201335.2361845-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/ip_tunnel_core.c