FAILED: patch "[PATCH] hv_netvsc: Stop PPI parsing on invalid metadata" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 19a227903e65c7a9c179156485660a4e017575fe
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026112517-devotion-snack-1302@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 19a227903e65c7a9c179156485660a4e017575fe Mon Sep 17 00:00:00 2001
From: Erni Sri Satya Vennela <[email protected]>
Date: Fri, 30 Oct 2026 02:34:59 -0700
Subject: [PATCH] hv_netvsc: Stop PPI parsing on invalid metadata
rndis_get_ppi() uses continue when a per-packet information entry has an invalid size or offset, or cannot hold the requested metadata. However, the remaining length and entry pointer are only updated at the bottom of the loop. Each error path therefore retries the same invalid entry indefinitely, repeatedly logging the error and preventing receive processing from completing.
Return NULL on these validation failures instead of continuing. This terminates the lookup when malformed metadata is encountered while preserving the existing behavior for valid entries.
The issue was reported through an internal bug-tracking system and confirmed by manual code inspection. The pre-fix hang has not been reproduced locally.
drivers/net/hyperv/rndis_filter.c +3 -3
@@ -401,12 +401,12 @@ static inline void *rndis_get_ppi(struct net_device *ndev,/* Validate ppi_offset and ppi_size */ if (ppi->size > len) {netdev_err (ndev,"Invalid ppi size: %u\n" , ppi->size); -continue ; +return NULL ; }if (ppi->ppi_offset >= ppi->size) {netdev_err (ndev,"Invalid ppi_offset: %u\n" , ppi->ppi_offset); -continue ; +return NULL ; }if (ppi->type == type && ppi->internal == internal) {
@@ -414,7 +414,7 @@ static inline void *rndis_get_ppi(struct net_device *ndev,if (ppi->size - ppi->ppi_offset < ppi_size) {netdev_err (ndev,"Invalid ppi: size %u ppi_offset %u\n" , ppi->size, ppi->ppi_offset); -continue ; +return NULL ; }return (void *)((ulong )ppi + ppi->ppi_offset); }
Sasha Levin
maintainerPATCH 1/2 hv_netvsc: Add (more) validation for untrusted Hyper-V values
From: "Andrea Parri (Microsoft)" <[email protected]>
[ Upstream commit 505e3f00c3f3648cb6260deb35e87fae1f64f5d8 ]
For additional robustness in the face of Hyper-V errors or malicious behavior, validate all values that originate from packets that Hyper-V has sent to the guest. Ensure that invalid values cannot cause indexing off the end of an array, or subvert an existing validation via integer overflow. Ensure that outgoing packets do not have any leftover guest memory that has not been zeroed out.
Stable-dep-of: 19a227903e65 ("hv_netvsc: Stop PPI parsing on invalid metadata")
--- drivers/net/hyperv/netvsc.c | 3 +- drivers/net/hyperv/netvsc_bpf.c | 6 ++ drivers/net/hyperv/netvsc_drv.c | 18 +++- drivers/net/hyperv/rndis_filter.c | 171 +++++++++++++++++++----------- 4 files changed, 136 insertions(+), 62 deletions(-)
drivers/net/hyperv/netvsc.c +2 -1
@@ -932,6 +932,7 @@ static inline int netvsc_send_pkt(int ret;u32 ring_avail =hv_get_avail_to_write_percent (&out_channel->outbound); +memset (&nvmsg,0 ,sizeof (struct nvsp_message )); nvmsg.hdr.msg_type =NVSP_MSG1_TYPE_SEND_RNDIS_PKT ;if (skb) rpkt->channel_type =0 ;/* 0 is RMC_DATA */
@@ -1354,7 +1355,7 @@ static void netvsc_send_table(struct net_device *ndev,sizeof (union nvsp_6_message_uber );/* Boundary check for all versions */ -if (offset > msglen - count *sizeof (u32)) { +if (msglen < count *sizeof (u32) || offset > msglen - count *sizeof (u32)) {netdev_err (ndev,"Received send-table offset too big:%u\n" , offset);return ;
drivers/net/hyperv/netvsc_bpf.c +6 -0
@@ -37,6 +37,12 @@ u32 netvsc_run_xdp(struct net_device *ndev, struct netvsc_channel *nvchan,if (!prog) goto out; +/* Ensure that the below memcpy() won't overflow the page buffer. */ +if (len > ndev->mtu +ETH_HLEN ) { + act =XDP_DROP ; + goto out; + } +/* allocate page buffer for data */ page =alloc_page (GFP_ATOMIC );if (!page) {
drivers/net/hyperv/netvsc_drv.c +17 -1
@@ -763,6 +763,16 @@ void netvsc_linkstatus_callback(struct net_device *net,if (indicate->status ==RNDIS_STATUS_LINK_SPEED_CHANGE ) {u32 speed; +/* Validate status_buf_offset */ +if (indicate->status_buflen <sizeof (speed) || + indicate->status_buf_offset <sizeof (*indicate) || + resp->msg_len -RNDIS_HEADER_SIZE < indicate->status_buf_offset || + resp->msg_len -RNDIS_HEADER_SIZE - indicate->status_buf_offset + < indicate->status_buflen) { +netdev_err (net,"invalid rndis_indicate_status packet\n" ); +return ; + } + speed = *(u32 *)((void *)indicate + indicate->status_buf_offset) /10000 ; ndev_ctx->speed = speed;
@@ -868,8 +878,14 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,*/ if (csum_info && csum_info->receive.ip_checksum_value_invalid && csum_info->receive.ip_checksum_succeeded && - skb->protocol ==htons (ETH_P_IP )) + skb->protocol ==htons (ETH_P_IP )) { +/* Check that there is enough space to hold the IP header. */ +if (skb_headlen (skb) <sizeof (struct iphdr )) { +kfree_skb (skb); +return NULL ; + }netvsc_comp_ipcsum (skb); + }/* Do L4 checksum offload if enabled and present. */ if (csum_info && (net->features &NETIF_F_RXCSUM )) {
drivers/net/hyperv/rndis_filter.c +111 -60
252 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 hv_netvsc: Stop PPI parsing on invalid metadata
From: Erni Sri Satya Vennela <[email protected]>
[ Upstream commit 19a227903e65c7a9c179156485660a4e017575fe ]
rndis_get_ppi() uses continue when a per-packet information entry has an invalid size or offset, or cannot hold the requested metadata. However, the remaining length and entry pointer are only updated at the bottom of the loop. Each error path therefore retries the same invalid entry indefinitely, repeatedly logging the error and preventing receive processing from completing.
Return NULL on these validation failures instead of continuing. This terminates the lookup when malformed metadata is encountered while preserving the existing behavior for valid entries.
The issue was reported through an internal bug-tracking system and confirmed by manual code inspection. The pre-fix hang has not been reproduced locally.
--- drivers/net/hyperv/rndis_filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/hyperv/rndis_filter.c +3 -3
@@ -401,12 +401,12 @@ static inline void *rndis_get_ppi(struct net_device *ndev,/* Validate ppi_offset and ppi_size */ if (ppi->size > len) {netdev_err (ndev,"Invalid ppi size: %u\n" , ppi->size); -continue ; +return NULL ; }if (ppi->ppi_offset >= ppi->size) {netdev_err (ndev,"Invalid ppi_offset: %u\n" , ppi->ppi_offset); -continue ; +return NULL ; }if (ppi->type == type && ppi->internal == internal) {
@@ -414,7 +414,7 @@ static inline void *rndis_get_ppi(struct net_device *ndev,if (ppi->size - ppi->ppi_offset < ppi_size) {netdev_err (ndev,"Invalid ppi: size %u ppi_offset %u\n" , ppi->size, ppi->ppi_offset); -continue ; +return NULL ; }return (void *)((ulong )ppi + ppi->ppi_offset); }
Signature · 1 line
2.53.0