vxlan_xmit_one() calls skb_vlan_inet_prepare() to pull the inner network header into linear memory before assigning old_iph = ip_hdr(skb). That helper checks skb->protocol (skipping VLAN tags) and only pulls an IPv4 or IPv6 header when the inner protocol is ETH_P_IP or ETH_P_IPV6. However, the VXLAN_DF_INHERIT branch inspects eth_hdr(skb)->h_proto before reading old_iph->frag_off. With AF_PACKET/SOCK_RAW, eth->h_proto and skb->protocol are independent: a 14-byte Ethernet frame with h_proto set to ETH_P_IP and sll_protocol set to ETH_P_ARP passes skb_vlan_inet_prepare() with only ETH_HLEN bytes pulled, leaving old_iph pointing at skb->tail. Reading old_iph->frag_off then accesses 6 bytes past skb->tail in uninitialized tailroom and copies one bit into the outer IPv4 DF bit. Using eth_hdr(skb)->h_proto also fails to inherit DF for VLAN-tagged packets and reads past the nonexistent Ethernet header on VXLAN-GPE packets without Ethernet encapsulation. Use skb_protocol(skb, true) to match skb_vlan_inet_prepare(), as the TTL, DSCP and flowlabel inheritance helpers already do. Discovered by manual code inspection following the sibling geneve DF-inherit fix, with Gemini assisting in path verification and preparing this patch and changelog. Verified by static analysis and compile testing only; the out-of-bounds read was not triggered or tested at runtime. Fixes: b4d3069783bc ("vxlan: Allow configuration of DF behaviour") Cc: stable@vger.kernel.org Signed-off-by: Yuansheng Yang <0xbeac@gmail.com> --- Sibling geneve fix on netdev/lkml: https://lore.kernel.org/lkml/20261125235524.4139551-1-xmei5@asu.edu/ Testing: drivers/net/vxlan/vxlan_core.o compiled with W=1 on x86_64 (GCC 15.2.0, CONFIG_VXLAN=y, CONFIG_KASAN=y) with no warnings or errors; git apply --check passes. Not dynamically tested; no runtime reproducer was executed. Checked against net.git HEAD ef3e21c61baa (whose vxlan_core.c matches the base-commit blob below). drivers/net/vxlan/vxlan_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index d11028b37472..76a1828111ea 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -2551,10 +2551,10 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, if (cfg->df == VXLAN_DF_SET) { df = htons(IP_DF); } else if (cfg->df == VXLAN_DF_INHERIT) { - struct ethhdr *eth = eth_hdr(skb); + __be16 inner_proto = skb_protocol(skb, true); - if (ntohs(eth->h_proto) == ETH_P_IPV6 || - (ntohs(eth->h_proto) == ETH_P_IP && + if (inner_proto == htons(ETH_P_IPV6) || + (inner_proto == htons(ETH_P_IP) && old_iph->frag_off & htons(IP_DF))) df = htons(IP_DF); } -- 2.43.0 base-commit: c710c654b8a3c92b34e38740dc17c29daf5b222e