๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14728

Re: [PATCH net v6 2/3] tun: clear stale skb->protocol of NAPI frags skbs

#14728
From: netdev-bot+sashiko
Date: Wed, 11 Nov 2026 22:41
76 lines
10766 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message understates what the bug does in the tree as
  it stands.

--

tun: clear stale skb->protocol of NAPI frags skbs

This commit clears skb->protocol in tun_napi_alloc_frags(). After a
GRO_MERGED_FREE merge, the skb recycled by napi_reuse_skb() still holds
the previous frame's ethertype. The virtio header checks in tun_get_user()
run before eth_type_trans(), so without this change they see that stale
value.

Closes: https://lore.kernel.org/netdev/179386753589.488856.11455181721004759454@kernel.org/

> tun_get_user() calls tun_vnet_hdr_tnl_to_skb() before eth_type_trans(),
> so the virtio header checks see the protocol of the previous frame:
> GSO packets without VIRTIO_NET_HDR_F_NEEDS_CSUM are dissected with the
> wrong protocol. A following change checks the outer protocol of UDP
> tunnel GSO packets, which would then reject a valid frame when the two
> ethertypes differ.

[Severity: Low]
This isn't a bug, but could the commit message say more about the impact
in the current tree? As written, the visible failure seems to depend on
the follow-up change. The stale protocol looks like it already causes
problems without that change.

In __virtio_net_hdr_to_skb(), the GSO branch without NEEDS_CSUM only
parses the real ethertype when skb->protocol is zero:

include/linux/virtio_net.h:__virtio_net_hdr_to_skb() {
    ...
	} else if (gso_type) {
		...
		if (!skb->protocol) {
			skb->protocol = dev_parse_header_protocol(skb);
			if (!skb->protocol)
				virtio_net_hdr_set_proto(skb, hdr);
		}
retry:
		if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys,
    ...
}

When napi_frags_skb() has left a non-zero value from the previous frame,
the dissector starts at the network offset and uses the previous frame's
ethertype.

After that, the only check is virtio_net_hdr_match_proto() on the
dissected n_proto. Nothing compares it with the frame's real ethertype.

Two outcomes seem possible today:

  - A valid frame is rejected with -EINVAL. For example, a TCPV4 GSO
    frame arrives after an IPv6 frame was merged. The IPv4 header is then
    parsed as IPv6, and either ip_proto or n_proto fails to match.

  - A GSO frame whose real ethertype does not match its GSO type is
    accepted, because the stale ethertype makes the payload parse as the
    expected protocol. eth_type_trans() then sets an skb->protocol that
    disagrees with gso_type.

Could these effects be mentioned in the message? That would show stable
backporters that the fix matters on its own, not only once the follow-up
change lands.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110213628.3476051-1-edumazet%40kernel.org
Technical Details
Message-ID: <179443691047.2199510.8260837937494054513@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361329-linux-kernel-netdev=dewy.ru
References: <20261110213628.3476051-3-edumazet@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361329-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v6 2/3] tun: clear stale skb->protocol of NAPI frags skbs
Date: Wed, 11 Nov 2026 22:41:50 +0000
Organization: Usenet Network
Message-ID: <179443691047.2199510.8260837937494054513@kernel.org>
References: <20261110213628.3476051-3-edumazet@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="957214"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wIJ0tZ+TFFdGgEwXxNJUw/uf/Ys= sha256:veCSxDpMjUj8OUTHT/6WUt2RYVDUwxIF0xDtmwdmYCY=
	sha1:v4SAfl7DcnOpuJI6qElVej3GVK0= sha256:FPKYuAJYVdouYnpBpd/t6BPJN4LjNlsOLMVjWwVonec=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 964F311403A; Thu, 12 Nov 2026 01:54:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id p3c5Vek9pbfh;
	Thu, 12 Nov 2026 01:54:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-361329-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 58599114037; Thu, 12 Nov 2026 01:53:57 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 57484103167; Wed, 11 Nov 2026 22:43:35 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794436912;
	b=DsZpZK5WoZVJm2XplyVMFV4cPye83Mww4GLOlrFQODx1+IIDzr6Utiucx1JR0DcNqBXA
	 G1vp1ydTmwnN3QIqZac8ID10qTM4O7c5EvtJjRwpBMka3/OVa6lRyxrJh+9kGUq+2RyAc
	 Jzv3OoQq4PXGckLynHH+CL8DdguLQlmy/+UFg4zuzBWiJANWZeWRkYZncAFA5hgA5fWQe
	 ZPQarkj2QEFPeIIYBK4+84xVpcSOyALzJ1cxPJhnzKooiX0VtozvPNyUM+gYC89ibNzv2
	 8NBHFFrAGDt/UlMmBNWvAygyyo0daGrgl5pp9ECDuH9JnvRJSyxK+zlfGsgVd1U5WnQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794436912;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=xIIn3V9P0kvomPcqYmph69rmh1CiZzPmlRG5882C640=;
	b=H59R96wgMl2frpESG71fyEwcwY08ai9v4PIsAaQaWiYvAqcawEVS5nrIiTTnN43m28gn
	 cxowrqn5l2W1et/c85r/S2iKsDFJ9NXXTQnDxNn+sz4ABdQur22BBbJ5cmk3zJpfFYp1M
	 IoLnJf72TvJPuP35b45TeKP0zDwLQ4ftQbfioP+mGmPs1vMosulDDWM762V4V+w2L9xxO
	 AzYWk+p3fkGCS0zqFODedHBnw/wDo6uZJem87G668D5oJSoGBPN51HPHB7OBdzEo1hMoF
	 TTwuR1a275lL73D0SMK3Ec8fUlhx4xw/qjiJescfb89aK9YhgiaiQh3ueCwseOjrItg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="St6nQ/0F";
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C0EC606E293;
	Wed, 11 Nov 2026 22:41:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=St6nQ/0F
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794436911;
	b=wXrKmy7OMGz1FQnaeqsAT5QMH+GqTR/6tDhwd3/6zidY+0bahB38nfhM0ZDS/3iprcJZ
	 k14sgWiL6hgqNhhzIsgCMM2i6H5dlYrCIn58cjl2YqgW6mCHuSCrXlUddIOCn1LAV5C45
	 iFKcN+KIcZWiBSD1im0sk6YS//1mAB6TwDMCW+hqm2Fg5LqSbu4e4wn6FzG0/eRrPy3FU
	 cKL6BakiLlT/XgFJwwhlUGzsgJ8vRHnNw4f1Ngc1ij9r47x3VPpOvIU2xvP1WhIWPtDhp
	 B+ue85Jj0JuCAgbBQu5fvEiGGHxLjKeBJxnVGPwnSBhdfnwyCqtEt1ab2Kl8vghl4Rg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794436911;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=xIIn3V9P0kvomPcqYmph69rmh1CiZzPmlRG5882C640=;
	b=AQA8jFacD9dYyyOExQZgt3ExIX6+EfbkNDy+61x06EKl/4A2kcUsj0Kxrgcj35lXFzUS
	 xexvDbqrVzP5gWYYnRTvJZWqlw8LIK+B3IS+OolM8YykT/lgalCw2K899TacPnkWaV0Jt
	 qkV4V7JyyaOnftM1Bgf1oZYoooayNfVm063JHB0EBUBAreobJtXeR3+we5dQoiFuGtdNj
	 mFOCLK/QOqe285CFBL5YIL0o59x7BjCWMbGyEMBxdo55lrnDsiIHfydEnSN1/jRViWgpi
	 ln7dfpnzNkS1ZtDPj1oAt1zKpwQC2nVyBkq/kVo6z8c8JW4MRY6XJUHSd08Ak6PyyVw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="St6nQ/0F";
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD071606A88B;
	Wed, 11 Nov 2026 22:41:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E42131F00A05;
	Wed, 11 Nov 2026 22:41:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794436911;
	bh=xIIn3V9P0kvomPcqYmph69rmh1CiZzPmlRG5882C640=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=St6nQ/0Fpg8GjtI3V195lQd0hmTrcEiQt9GelJFtAshaHLqFftxmdx4tyJ9Hs4WVc
	 qxRc7l+cfudfne7Xb4GUV0FNcohNSZtRlcQz43HN4zVTt7A11rstEkF2zThclZyURf
	 vCIWcnm4PXf+fAHOoxtz+tPHcoXDMdyaAUDjA3FIPCw+Cy9ZG2abWOBv40b+wFBgh+
	 90phhu2QPtJinrSIPq4lMUqzgrfxhjb7gjItn6+YxlZCb7SLxJ91sxI2+Bb2zLBvN3
	 Y2rvf+jGI2rvZTlyPm/S1Haku/LKz2CE4/2mEjsZZV458von1OtksD+XD6SNNMs4rV
	 DH55pX9XMpktg==
X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
 netdev@vger.kernel.org, willemb@google.com, horms@kernel.org, mst@redhat.com,
 jasowangio@gmail.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com,
 hassansultan@google.com, virtualization@lists.linux.dev
X-In-Reply-To: <20261110213628.3476051-3-edumazet@kernel.org>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list