From: Wei Liu <wei.liu@kernel.org>
To: Yuho Choi <oss.patchbox@gmail.com>
Cc: "K . Y . Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
Long Li <longli@microsoft.com>,
Jinank Jain <jinankjain@linux.microsoft.com>,
Nuno Das Neves <nunodasneves@linux.microsoft.com>,
Easwar Hariharan <easwar.hariharan@linux.microsoft.com>,
Praveen K Paladugu <prapal@linux.microsoft.com>,
Tianyu Lan <tiala@microsoft.com>,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v1] mshv: Don't free overlay pages after a failed unmap
Date: Wed, 21 Oct 2026 00:18:53 -0700 [thread overview]
Message-ID: <20261021071853.GF851443@liuwe-devbox-debian-v2.local> (raw)
In-Reply-To: <20261012042851.389128-1-oss.patchbox@gmail.com>
On Mon, Oct 12, 2026 at 12:28:35AM -0400, Yuho Choi wrote:
[...]
>
> drivers/hv/mshv_root_hv_call.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hv/mshv_root_hv_call.c b/drivers/hv/mshv_root_hv_call.c
> index cb55d4d4be2e5..9614cee4dad39 100644
> --- a/drivers/hv/mshv_root_hv_call.c
> +++ b/drivers/hv/mshv_root_hv_call.c
> @@ -651,8 +651,18 @@ int hv_unmap_vp_state_page(u64 partition_id, u32 vp_index, u32 type,
> {
> int ret = hv_call_unmap_vp_state_page(partition_id, vp_index, type, input_vtl);
>
> - if (mshv_use_overlay_gpfn() && state_page)
> - __free_page(state_page);
> + if (mshv_use_overlay_gpfn() && state_page) {
> + /*
> + * If the unmap failed, the hypervisor may still be using the
> + * page as an overlay. Leak it rather than handing it back to
> + * the page allocator.
> + */
> + if (ret)
> + pr_err("%s: failed to unmap partition %llu vp %u state page type %u, leaking page: %d\n",
> + __func__, partition_id, vp_index, type, ret);
> + else
> + __free_page(state_page);
> + }
>
> return ret;
> }
> @@ -1003,7 +1013,12 @@ int hv_unmap_stats_page(enum hv_stats_object_type type,
>
> ret = hv_call_unmap_stats_page(type, identity);
>
> - if (mshv_use_overlay_gpfn() && page_addr)
> + /*
> + * If the unmap failed, the hypervisor may still be updating the
> + * overlay page. Leak it rather than handing it back to the page
> + * allocator.
> + */
> + if (mshv_use_overlay_gpfn() && page_addr && !ret)
> __free_page(virt_to_page(page_addr));
I would like to get an error or a warning here, too. Can you send v2?
Thanks,
Wei
>
> return ret;
> --
> 2.43.0
prev parent reply other threads:[~2026-10-21 7:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 4:28 Yuho Choi
2026-10-21 7:18 ` Wei Liu [this message]
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=20261021071853.GF851443@liuwe-devbox-debian-v2.local \
--to=wei.liu@kernel.org \
--cc=decui@microsoft.com \
--cc=easwar.hariharan@linux.microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=jinankjain@linux.microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=nunodasneves@linux.microsoft.com \
--cc=oss.patchbox@gmail.com \
--cc=prapal@linux.microsoft.com \
--cc=stable@vger.kernel.org \
--cc=tiala@microsoft.com \
/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
all inboxes | Powered by JetHome®