Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: use skb_header_pointer() for TCPv4 GSO frag_off check

Syzbot reported a KMSAN uninit-value warning in gso_features_check()
called from netif_skb_features() [1].

gso_features_check() reads iph->frag_off to decide whether to clear
mangleid_features. Accessing the IPv4 header via ip_hdr()/inner_ip_hdr()
can rely on skb header offsets that are not always safe for direct
dereference on packets injected from PF_PACKET paths.

Use skb_header_pointer() for the TCPv4 frag_off check so the header read
is robust whether data is already linear or needs copying.

[1] https://syzkaller.appspot.com/bug?extid=1543a7d954d9c6d00407

Link: https://lore.kernel.org/netdev/willemdebruijn.kernel.1a9f35039caab@gmail.com/
Fixes: cbc53e08a793 ("GSO: Add GSO type for fixed IPv4 ID")
Reported-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1543a7d954d9c6d00407
Tested-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com
Signed-off-by: Guoyu Su <yss2813483011xxl@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260327153507.39742-1-yss2813483011xxl@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Guoyu Su and committed by
Jakub Kicinski
ddc748a3 514aac35

+8 -3
+8 -3
net/core/dev.c
··· 3821 3821 * segmentation-offloads.rst). 3822 3822 */ 3823 3823 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { 3824 - struct iphdr *iph = skb->encapsulation ? 3825 - inner_ip_hdr(skb) : ip_hdr(skb); 3824 + const struct iphdr *iph; 3825 + struct iphdr _iph; 3826 + int nhoff = skb->encapsulation ? 3827 + skb_inner_network_offset(skb) : 3828 + skb_network_offset(skb); 3826 3829 3827 - if (!(iph->frag_off & htons(IP_DF))) 3830 + iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); 3831 + 3832 + if (!iph || !(iph->frag_off & htons(IP_DF))) 3828 3833 features &= ~dev->mangleid_features; 3829 3834 } 3830 3835