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

Reply via email to