๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7150

Re: [PATCH net v5 7/7] virtio_net: cleanup protocol calculation

#7150
From: netdev-bot+sashiko
Date: Sun, 25 Oct 2026 05:31
59 lines
10601 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] net: use-after-free read of iph->ihl after pskb_may_pull() in
  ip4_parse()

--

> diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
> --- a/include/linux/virtio_net.h
> +++ b/include/linux/virtio_net.h
> @@ -638,7 +638,6 @@ virtio_net_hdr_tnl_to_skb(struct sk_buff *skb,
>  	 * We know VIRTIO_NET_HDR_F_NEEDS_CSUM was set so __virtio_net_hdr_to_skb
>  	 * set CHECKSUM_PARTIAL.
>  	 */
> -	inner_proto = inner_isv6 ? htons(ETH_P_IPV6) : htons(ETH_P_IP);
>  	if (virtio_net_csum_partial_ok_at_offset(skb, gso_inner_type, inner_nh,
>  						 inner_proto))
>  		return 0;

[Severity: High]
This isn't introduced by this patch, but since inner_proto is what
steers virtio_net_csum_partial_ok_at_offset() into the IPv4 parser,
it's worth raising here.

virtio_net_csum_partial_ok_at_offset() calls virtio_net_l4_start(),
which for ETH_P_IP calls ip4_parse(). In ip4_parse() the fixed header
is pulled, iph is set to skb->data + nhoff, and then a second
pskb_may_pull(skb, nhoff + iph->ihl * sizeof(u32)) pulls in the
options. That second pull can go through __pskb_pull_tail() and
pskb_expand_head() when the options sit in paged frags, the skb is
cloned, or CONFIG_FAIL_SKB_REALLOC fires, and that frees the old
skb->head. The next line then computes *thoff from iph->ihl through
the stale pointer, before the header is reloaded from skb->data.

That is a use-after-free read that a guest, or a tun/tap/af_packet
user, can trigger with an IPv4 header whose options straddle the
linear area. If the freed buffer has been reused, we can also end up
with a bogus *thoff that is then checked against csum_start. Since
ip4_parse() is shared with ip_rcv_core(), br_validate_ipv4() and
nf_reject_iphdr_validate(), plain IPv4 ingress hits it too.

Reading ihl into a local before the second pskb_may_pull(), or
reloading iph from skb->data right after it, should be enough.
Do you want to fold a fix for ip4_parse() into this series, or send
it separately to net with a Fixes: tag for the commit that added
ip4_parse()?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.v5.git.mst%40redhat.com
Technical Details
Message-ID: <179290626754.3134.7007257150281295117@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351492-linux-kernel-netdev=dewy.ru
References: <f8621d16cf0c67335641d07c1555ec1e43f17628.1792668082.git.mst@redhat.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351492-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v5 7/7] virtio_net: cleanup protocol calculation
Date: Sun, 25 Oct 2026 05:31:07 +0000
Organization: Usenet Network
Message-ID: <179290626754.3134.7007257150281295117@kernel.org>
References: <f8621d16cf0c67335641d07c1555ec1e43f17628.1792668082.git.mst@redhat.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="946559"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:y/xV3ewsw4qFVWmU8XD3kajrqEo= sha256:HnzQr8vleJs/wdnBjzGwbBcgwv/qRixRD3UVmzODgeM=
	sha1:/QPd0xj6CfJVgZ7eZfRQx60c+Gs= sha256:BRMxzuksILCu4qDGg66/rtyagv564I1e5vMP6+T0trE=
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 DBDAB125B29; Sun, 25 Oct 2026 08:35:42 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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] 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 yyyFwCXUcrMr;
	Sun, 25 Oct 2026 08:35:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351492-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 08936125B27; Sun, 25 Oct 2026 08:35:31 +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 9A15F3AAC3; Sun, 25 Oct 2026 05:31:25 +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=1792906285;
	b=rzTOl+E3v0gjbULzSuPAfui6pcH8qVB0ELM0AQiSP9EUPNzdpOsPoH1DRqyPJcQ4FVJE
	 u+jKIJbMpxwCbU9lpPqUbkdq5wi9QLLVmwdXAXq4V5Lh0bmhVj1Kk8OvJ57V08FJtDQw5
	 4M0cXqGYPYifS42A7lHAwpluEaZJASjpk1IKfFTaGdtXOEoqwuOloMuG9VNeRRAETaDA9
	 YJnwfGptMXOi2j5H2jrM6zifgKIz7g5YrwOa37RC25A0hnHxYsseqqwCTfvWWesbTDfNI
	 T+XuhKBeH+pg+qz/sATtEwVL8M2uHb4BxbjUv7u9bRXcjw4xVnS0cj6+9oU91W8TTNA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792906285;
	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=YTAKiPjHb/nBDo+pPfj3THkCS5OujSZt/0Kav2/2Tn4=;
	b=jBKM2LTwqiW6w+g32jcvkcgYgeyViU7eRE4oOcGDrS7bxDsGFYgdPuGrbwPO9Q9zN6V1
	 SYWeWFJtzXCObtaqdHg2yOPSEOMu6c1k594fQ7IxWoTxyNR4PjnSjE2kIWXsfG1AnQCz/
	 2n+RuZGC+KHCBh4buO5/RleZqlM2dHczfVY4N1B+UIJDpCVpqzmlNhEIhCBqQeSLKeTpZ
	 tD4z+X4xQJW8hqvl2C9qh1E9cQfYX06kUlNAkj3sYg/0qPsp9EGaOMdtd24WdVqJUrPRB
	 Qi5uZKapMrmJtZ9dDhhNTalXfMkFDDjL6PbsnQ0HObSbp2+EkP8qvhx8/ppB0GcNKBQ==
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=VD1fJgiD;
	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 691B7606A328;
	Sun, 25 Oct 2026 05:31:25 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VD1fJgiD
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=1792906269;
	b=yEYPacrK8u/XOcFePRqEs5Gy3j92lEpwz6kmf3oWEDMp5R299rOdmZn39PX1uoz/ZYNu
	 Oool04WEy6D3Sbhro4nEsRAM/ogUsieplMKav43f7ukZiYfALl53QAjqVP3TTwLg4CvOV
	 LMhu/dNwT/JDi8XTLzdDDK/eDzqy9OspW+HWR7YSBfQ1tWA19b2vx5eDCI4JhFZE+j0tL
	 uuaJnLFKYnrm4qHY+VU3Uch05jypkL9K+NIUY7k1UYXm62oHCxYMaHuKWzAt3moeELZuF
	 RkYoeucSGOjCvJNf6dlgsem3MiTpajycqwd20qxc3e8eGxhgTQIRYzqgkDudD/qUutw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792906269;
	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=YTAKiPjHb/nBDo+pPfj3THkCS5OujSZt/0Kav2/2Tn4=;
	b=y+8H8CZaMvIeI+Ci9jzTNJc0iPcRjXO2rl+4OFC4SW+zIWoY9PkTH+9LBAFOt74cNTBT
	 eKEEyFVEmgDJT4Haa0PmySNt0srlMxuXcLXSNDo7c0+eu/Oad18m0jpYD36TFTVxpQn3f
	 n8+Kl0J6TtlHsCn2PCrVp2XfYl2YwsatjHLxMDGT5JgTykloz5IIPCghZQqZfd+J7yNPS
	 iVRrcwGZ42h3OFwQkZT8ri3aTwc3RYbzdLG+9kJK7fICldYRVf07nFf1BC27Kg6sAU5/P
	 OyrboCj+lRW1lK4tgYqvKjq4SQNYQGotISLwcTwnUeMsk4Kt225W0O4mCzGxiq9K1Kw==
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=VD1fJgiD;
	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 45943606A32C;
	Sun, 25 Oct 2026 05:31:09 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F22361F01829;
	Sun, 25 Oct 2026 05:31:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792906268;
	bh=YTAKiPjHb/nBDo+pPfj3THkCS5OujSZt/0Kav2/2Tn4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=VD1fJgiDa+wxB9P6d0pDvkl5xzVjZZ7lAhik3mAx4sYyjBP/iLTdr6UgW+/5mMDwK
	 +lyTbP6kq3lQrWLqjqCj1xMIDJ9qMHNQMoigiFS96gRIWQPVx3LsVZVPkliabGROIK
	 rm/ij3fsM616CGx8eIz5MBjbr2J8GXMacXPW2/6Jz6dswlminkcGOcWT3u1oci5mfG
	 1j3fezEIxpDQ9A8U2ejKVNWfAq+yrEapcZH6hiT2HhHbfpSnFtwuthtUNLDIRty+3u
	 cjcpdDASuffShCiO+Zz7GkMIlSvjbL0OaJ0sFiLp50Pv8mqhIREcGXqowwvv0kHQg7
	 SNHVUjTXqFZcw==
X-Cc: linux-kernel@vger.kernel.org, willemdebruijn.kernel@gmail.com,
 carges@cloudflare.com, bjorn@kernel.org, phil@nwl.cc, jasowangio@gmail.com,
 eperezma@redhat.com, xuanzhuo@linux.alibaba.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 netdev@vger.kernel.org, virtualization@lists.linux.dev, maxk@qualcomm.com,
 rusty@rustcorp.com.au
X-In-Reply-To:  <f8621d16cf0c67335641d07c1555ec1e43f17628.1792668082.git.mst@redhat.com>
X-sashiko-severity: High
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