mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Repeated decapsulation can leave skb->data far from skb->head while
the remaining packet data is still valid. Since the skb header positions
are 16-bit offsets, a later header update can truncate and make header
access use unrelated bytes and eventually crash.
Limit receive headroom to 32 KiB. This is well beyond the headroom of
normal packets while allowing the networking stack to pull enough
headers in a single pass without overflowing 16-bit header offsets.
Tunnel decapsulation re-enters __netif_receive_skb_core(), so its check
protects nested IPIP and GRE. FOU and GUE bypass receive core, so check
their IPv4 and IPv6 resubmission paths too. Together, these checks
prevent 16-bit header-offset truncation in cases of repeated
decapsulation.
Report these rejections with the SKB_RX_HEADROOM drop reason.
Fixes: 1a37e412a0 ("net: Use 16bits for *_headers fields of struct skbuff")
Cc: [email protected]
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Chris J Arges <[email protected]>
Reviewed-by: Ido Schimmel <[email protected]>
Link: https://patch.msgid.link/20261118-prevent_rx_header_offset_overflow-v1-1-92a5be55f994@cloudflare.com
Signed-off-by: Paolo Abeni <[email protected]>