]> git.ipfire.org Git - thirdparty/linux.git/commit
udp: fix potential use-after-free in tunnel segmentation
authorXuanqiang Luo <luoxuanqiang@kylinos.cn>
Thu, 30 Jul 2026 09:35:54 +0000 (17:35 +0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 4 Aug 2026 01:32:47 +0000 (18:32 -0700)
commitd0f86fb36eb260abd10007b62c9dcc1028e03e61
tree9735d41d87402512a553c17163edc70217690d8a
parentd141f087b1af656f055d7c5793a3e87817ba0bbe
udp: fix potential use-after-free in tunnel segmentation

__skb_udp_tunnel_segment() gets the UDP header before ensuring the
tunnel header is in the skb head. If the pull reallocates skb->head,
the saved UDP header pointer is no longer valid.

Get the UDP header after the pull to avoid a potential use-after-free.

Fixes: dbef491ebe7f ("udp: Use uh->len instead of skb->len to compute checksum in segmentation")
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Link: https://patch.msgid.link/20260730093554.68127-1-xuanqiang.luo@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/udp_offload.c