Re: [PATCH --to=kys@xxxxxxxxxxxxx,haiyangz@xxxxxxxxxxxxx,wei.liu@xxxxxxxxxx,decui@xxxxxxxxxxxxx,longli@xxxxxxxxxxxxx] mshv: Fix interrupt state corruption in hv_do_map_pfns error path

From: Stanislav Kinsburskii

Date: Tue Apr 21 2026 - 20:16:25 EST


On Tue, Apr 21, 2026 at 10:36:41PM +0000, Stanislav Kinsburskii wrote:
> Restore interrupt state before breaking out of the loop on error.
>

Please disregard

> The irq_flags are saved before entering the loop, but the early exit
> path on error fails to restore them. This leaves interrupts in an
> inconsistent state and can lead to lockdep warnings or other
> interrupt-related issues.
>
> Fixes: 621191d709b14 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")
> Signed-off-by: Stanislav Kinsburskii <skinsburskii@xxxxxxxxxxxxxxxxxxx>
> ---
> drivers/hv/mshv_root_hv_call.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hv/mshv_root_hv_call.c b/drivers/hv/mshv_root_hv_call.c
> index 7ed623668c8e..6381f949d9d9 100644
> --- a/drivers/hv/mshv_root_hv_call.c
> +++ b/drivers/hv/mshv_root_hv_call.c
> @@ -237,8 +237,10 @@ static int hv_do_map_pfns(u64 partition_id, u64 gfn, u64 pfns_count,
> } else {
> pfnlist[i] = mmio_spa + done + i;
> }
> - if (ret)
> + if (ret) {
> + local_irq_restore(irq_flags);
> break;
> + }
>
> status = hv_do_rep_hypercall(HVCALL_MAP_GPA_PAGES, rep_count, 0,
> input_page, NULL);
>
>