Linux-HyperV List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Emerson Busson" <emersonbusson@gmail.com>
Cc: linux-hyperv@vger.kernel.org
Subject: Re: [PATCH v2 09/14] hv: use owned VMBus buffers in NetVSC and UIO
Date: Thu, 08 Oct 2026 19:09:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-164493@kernel.org> (raw)
In-Reply-To: <20261007190752.336426-10-emersonbusson@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] hv_netvsc: host bugcheck DoS due to GPADL teardown after failed revoke
--

commit 418182ccc1e62bfbe8d59179d5fb1baf3aaa6d53
Author: Emerson Busson <emersonbusson@gmail.com>

    hv: use owned VMBus buffers in NetVSC and UIO

Move the remaining buffer consumers to the allocation, GPADL and release
entry points that carry one descriptor throughout their lifetime. Preserve
established exported signatures throughout the series.

> diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
> index ffba1443396ab..fd8aa7a3dcb32 100644
> --- a/drivers/net/hyperv/netvsc.c
> +++ b/drivers/net/hyperv/netvsc.c
> @@ -243,7 +243,6 @@ static void netvsc_revoke_recv_buf(struct hv_device *device,
>  		if (ret != 0) {
>  			netdev_err(ndev, "unable to send "
>  				"revoke receive buffer to netvsp\n");
> -			net_device->recv_buffer.leak = true;
>  			return;
>  		}
>  		net_device->recv_section_cnt = 0;
> @@ -295,7 +294,6 @@ static void netvsc_revoke_send_buf(struct hv_device *device,
>  		if (ret != 0) {
>  			netdev_err(ndev, "unable to send "
>  				   "revoke send buffer to netvsp\n");
> -			net_device->send_buffer.leak = true;
>  			return;
>  		}
>  		net_device->send_section_cnt = 0;
> @@ -308,18 +306,14 @@ static void netvsc_teardown_recv_gpadl(struct hv_device *device,
>  {
>  	int ret;
>  
> -	if (net_device->recv_buffer.leak)
> -		return;
> -
>  	if (net_device->recv_buffer.gpadl.gpadl_handle) {
> -		ret = vmbus_teardown_gpadl(device->channel,
> -					   &net_device->recv_buffer.gpadl);
> +		ret = vmbus_teardown_gpadl_owned(device->channel,
> +						 &net_device->recv_buffer);

[Severity: High]
With the removal of the leak check here and the manual assignment in
netvsc_revoke_recv_buf(), is there a risk of a host bugcheck if the
protocol-level revoke message fails?

If vmbus_sendpacket() returns an error (like -EAGAIN from a full ring) in
netvsc_revoke_recv_buf(), the NetVSP layer won't receive the revoke message
and might still actively map the GPADL. Unconditionally sending a VMBus GPADL
teardown request in this scenario violates the protocol invariant. Could
this lead to a Denial of Service via a host bugcheck or guest termination?

>  
>  		/* If we failed here, we might as well return and have a leak
>  		 * rather than continue and a bugchk
>  		 */
>  		if (ret != 0) {
> -			net_device->recv_buffer.leak = true;
>  			netdev_err(ndev,
>  				   "unable to teardown receive buffer's gpadl\n");
>  			return;
> @@ -333,18 +327,14 @@ static void netvsc_teardown_send_gpadl(struct hv_device *device,
>  {
>  	int ret;
>  
> -	if (net_device->send_buffer.leak)
> -		return;
> -
>  	if (net_device->send_buffer.gpadl.gpadl_handle) {
> -		ret = vmbus_teardown_gpadl(device->channel,
> -					   &net_device->send_buffer.gpadl);
> +		ret = vmbus_teardown_gpadl_owned(device->channel,
> +						 &net_device->send_buffer);

[Severity: High]
Similarly for the send buffer, does removing the leak check and flag tracking
in netvsc_revoke_send_buf() expose the host to the same bugcheck risk if
the revoke message fails to send?

>  
>  		/* If we failed here, we might as well return and have a leak
>  		 * rather than continue and a bugchk
>  		 */
>  		if (ret != 0) {
> -			net_device->send_buffer.leak = true;
>  			netdev_err(ndev,
>  				   "unable to teardown send buffer's gpadl\n");
>  			return;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261007190752.336426-1-emersonbusson@gmail.com?part=9

  reply	other threads:[~2026-10-08 19:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 19:07 [PATCH v2 0/14] hv: vmbus: make rings and host-visible buffers survive buddy fragmentation Emerson Busson
2026-10-07 19:07 ` [PATCH v2 01/14] hv: vmbus: convert ring backing through the chunk allocator Emerson Busson
2026-10-07 19:07 ` [PATCH v2 02/14] hv: vmbus: validate chunk buffer allocation and cleanup Emerson Busson
2026-10-08 21:17   ` kernel test robot
2026-10-07 19:07 ` [PATCH v2 03/14] uio: hv_generic: describe buffers for owned allocation Emerson Busson
2026-10-07 19:07 ` [PATCH v2 04/14] hv: vmbus: add KUnit tests for GPADL post failure injection Emerson Busson
2026-10-07 19:07 ` [PATCH v2 05/14] hv: vmbus: add KUnit test for order-zero allocation fallback Emerson Busson
2026-10-07 19:07 ` [PATCH v2 06/14] hv: vmbus: cover all shared-page policy combinations Emerson Busson
2026-10-07 19:07 ` [PATCH v2 07/14] hv: vmbus: distinguish host rescind from local channel unload Emerson Busson
2026-10-07 19:07 ` [PATCH v2 08/14] hv: vmbus: retain backing until ownership and references clear Emerson Busson
2026-10-08 19:09   ` sashiko-bot
2026-10-07 19:07 ` [PATCH v2 09/14] hv: use owned VMBus buffers in NetVSC and UIO Emerson Busson
2026-10-08 19:09   ` sashiko-bot [this message]
2026-10-07 19:07 ` [PATCH v2 10/14] hv: vmbus: pin buffer pages across UIO mmap to close the reclaim race Emerson Busson
2026-10-08 16:49   ` kernel test robot
2026-10-08 17:51     ` Nathan Chancellor
2026-10-08 17:02   ` kernel test robot
2026-10-08 19:09   ` sashiko-bot
2026-10-07 19:07 ` [PATCH v2 11/14] hv: vmbus: vmalloc requestor metadata Emerson Busson
2026-10-08 19:09   ` sashiko-bot
2026-10-07 19:07 ` [PATCH v2 12/14] hv: netvsc: allocate RNDIS request descriptors with kvzalloc_obj() Emerson Busson
2026-10-08 19:09   ` sashiko-bot
2026-10-07 19:07 ` [PATCH v2 13/14] hv: netvsc: handle a NULL request address on empty completions Emerson Busson
2026-10-08 19:09   ` sashiko-bot
2026-10-07 19:07 ` [PATCH v2 14/14] hv: netvsc: use kvzalloc for device state Emerson Busson
2026-10-08 19:09   ` sashiko-bot
2026-10-08 16:55 ` [PATCH v2 0/14] hv: vmbus: make rings and host-visible buffers survive buddy fragmentation Easwar Hariharan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-164493@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=emersonbusson@gmail.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox