From nobody Thu Apr 2 15:38:00 2026 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08DD23770B for ; Fri, 27 Mar 2026 15:35:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774625741; cv=none; b=X3XhhexxPgwvoC0CLJJfGj+73LiPYR1ccQdRfFAjMeesAIi9p2er5VqPdNzg4Kx2UiGDFny+HJRjHT6AeB/IBZWSIiEhfNQFvvujH0BmwP/c2x9JIHp2hQEB3Q6J17oQg4/ouT5258wtk90RzVmcA5EyOVYs7WfKOH3wr0DCGLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774625741; c=relaxed/simple; bh=9tGnF2uOc24xA7oV6IGN3IfFS2WdAyzc+CjZ1Y3zCpo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BqRiJ0QGc9g4Ex+m2ZMzSMxS3slF83KFkwTMKam4lap0WaEkR8Y+hH/4NH4eZXp724f0mgfyGG4tpi7rW25IunfF41ZbGoYqWG8jE/4ntZLiQSPQPchkPS9Luy7075PCS6lR5WKbbKmy3LNCp7DBXHwsWKImfTWqHWhfqYaDsUQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rFpI+8VL; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rFpI+8VL" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2aecefc7503so16028785ad.1 for ; Fri, 27 Mar 2026 08:35:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774625739; x=1775230539; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IZxaCG2wbeKGdyIyvVHQIkk/pIRMFC2kB/SluPbDe8w=; b=rFpI+8VL7F6a5ufC1OxjJcieJ863sl83DXlAsOJhomBOnFWyqxiKYHumNbx9tLGE3s DtWj77ulvNJvW19xl8bc5zP9rteflTXks2gmIs8xyct8bAdhBcVSUinM0VebaOVRGAZX Tpro4jg9zBQqzGjXJjdIx/5rSudifS2pl3Jdq8WZnMKBFWeCn2oZQMLiF1O2E0FPRfXx ggO3MN6Jthev9sxzkAvVnCn5C3fwQE5Dyk10cupZlLtpKN1rGbiWNsm0+wYYfyGZMlex aLsVgb52Wt4YACNEvd2bDWWBcmkuLK278UoeLlAVKFzFUSozn+UR/bMVjdy4cp7BjRQM t9Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774625739; x=1775230539; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=IZxaCG2wbeKGdyIyvVHQIkk/pIRMFC2kB/SluPbDe8w=; b=J2w4acpNEnrY2iYw7ON7+JPoRn4OPL1vkZ1tBItLsPnIFDXVsWs61Fqj6CStrkwfka ZoV9hT8Y0VNisuBau/vqx8ae8iLV6RxeedIjyN8OFdQ6xRRYZ3HtOHThs27YtikIvCA6 tILXz1ytfNFcuOofxk+CzK3x6Wcv2oQrNPQUynRiXLYalnkaFvCg1iHy3IlPyZ6J58lh tTU1J1oIqnpo/ICaNWyJWxsMIrPFQ6E9daoHyEDOXLt9vht75DsYioaCcHKaA/mi6aAY JDExTS2LYZ4FR04d2kcxZo4XJtIPf2VSntvwxDR36jyt/I/9H7vmdFSiu7Rbs+qMlGnC pIow== X-Forwarded-Encrypted: i=1; AJvYcCWMFkehgSNqn8MbWfIxRxCkQAhWy/cK2Wl3Wb9P7Wwt+H+1Ue1LiUr/id9MW3R5d0peuBs7nx/cS5J11N0=@vger.kernel.org X-Gm-Message-State: AOJu0Ywhs7PjhhwmPEEkwtf8P3lNafSqLy+PuytCkTeF1Fy6lxDDYbol H/OHOGSsbHoMI6zNgvD0+tP0gmP3XKZTEimF6rgU7sVXeoXyF5EpvCUn X-Gm-Gg: ATEYQzwWgMAWkjrr3KxkB2HFms8p3rZ1KWfkMo9rluXeZ/WEOFwPyRxhiT8Et53TPGG m3GeTfp/pD9/WWKD+G1v6NrdHv11cVqMFvmdj6zfHdfDqTERWsDXAulweU197FE9VDpxej2mE0m EK7wPrQ5h9tcyhs5cyWdP4Ki7vTIDJWtejyAt8z17pJZVPnWhFGhj4tJIUWN6quXWG9pNomnQlW qc2trXSADMB4L+5RCOv3dn9oqHgBu7Zw2qT/rX8PwfHzF7k3Om0pL1a49WFInWCpmLNhT3JquLV LfVpcKsTSNYaUhUNEWdRPx4mOQp9DvYECD/xRdron6OKVK5zide6lxGYaVJhhy/DGhzG7/TULP9 MbIiWWarvrfggrR/Q8m7ZNasEg3uLyLEPL5GLTO/tXMzFwZmwfV/HPSwHj7Y8z0RWjV/N8IX7UM dYo40XvE+eDjn7lzFtmv8ULmRIun+o01znYtWbf5YOe5/J4xC3qjcLu81/K1GKxsJh+CqrUoEq9 RogXEQye7uyRa7T1AzaKJoRj+W1nNXLoArGEAqbVGUBQXbhsibai6S9sqENoJAcBa78RSXc6SqM /8CY0X+4B4o= X-Received: by 2002:a17:903:285:b0:2b0:51f6:d468 with SMTP id d9443c01a7336-2b0cdc22e12mr36228035ad.17.1774625739173; Fri, 27 Mar 2026 08:35:39 -0700 (PDT) Received: from DellG15.localdomain (2001-b030-8055-ffc7-2d87-7642-b84f-7a21.hinet-ip6.hinet.net. [2001:b030:8055:ffc7:2d87:7642:b84f:7a21]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0bc7afad1sm79099845ad.31.2026.03.27.08.35.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2026 08:35:38 -0700 (PDT) From: Guoyu Su To: edumazet@google.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: willemdebruijn.kernel@gmail.com, netdev@vger.kernel.org, horms@kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com, Guoyu Su Subject: [PATCH net v7] net: use skb_header_pointer() for TCPv4 GSO frag_off check Date: Fri, 27 Mar 2026 23:35:07 +0800 Message-Id: <20260327153507.39742-1-yss2813483011xxl@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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=3D1543a7d954d9c6d00407 Link: https://lore.kernel.org/netdev/willemdebruijn.kernel.1a9f35039caab@gm= ail.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=3D1543a7d954d9c6d00407 Tested-by: syzbot+1543a7d954d9c6d00407@syzkaller.appspotmail.com Signed-off-by: Guoyu Su Reviewed-by: Willem de Bruijn --- v7: - Drop revision-diff wording from commit message body. - Minor style: keep variable definitions contiguous in gso_features_check(= ). - No functional change from v6. v6: https://lore.kernel.org/netdev/20260326121813.457049-1-yss2813483011xxl= @gmail.com/ v5: https://lore.kernel.org/netdev/20260320141459.9691-1-yss2813483011xxl@g= mail.com/ v4: https://lore.kernel.org/netdev/20260319005421.14908-1-yss2813483011xxl@= gmail.com/ v3: https://lore.kernel.org/netdev/20260312104351.185370-1-yss2813483011xxl= @gmail.com/ v2: https://lore.kernel.org/netdev/20260308083319.1255118-1-yss2813483011xx= l@gmail.com/ v1: https://lore.kernel.org/netdev/20260307162905.3697050-1-yss2813483011xx= l@gmail.com/ net/core/dev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index fc5557062414..831129f2a69b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3821,10 +3821,15 @@ static netdev_features_t gso_features_check(const s= truct sk_buff *skb, * segmentation-offloads.rst). */ if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4) { - struct iphdr *iph =3D skb->encapsulation ? - inner_ip_hdr(skb) : ip_hdr(skb); + const struct iphdr *iph; + struct iphdr _iph; + int nhoff =3D skb->encapsulation ? + skb_inner_network_offset(skb) : + skb_network_offset(skb); =20 - if (!(iph->frag_off & htons(IP_DF))) + iph =3D skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); + + if (!iph || !(iph->frag_off & htons(IP_DF))) features &=3D ~dev->mangleid_features; } =20 --=20 2.34.1