RE: [PATCH hyperv-next v4 09/16] Drivers: hv: Check message and event pages for non-NULL before iounmap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Roman Kisel <romank@xxxxxxxxxxxxxxxxxxx> Sent: Monday, July 14, 2025 3:16 PM
> 
> It might happen that some hyp SynIC pages aren't allocated.
> 
> Check for that and only then call iounmap().
> 
> Signed-off-by: Roman Kisel <romank@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/hv/hv.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 820711e954d1..a8669843c56e 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -367,8 +367,10 @@ void hv_synic_disable_regs(unsigned int cpu)
>  	 */
>  	simp.simp_enabled = 0;
>  	if (ms_hyperv.paravisor_present || hv_root_partition()) {
> -		iounmap(hv_cpu->hyp_synic_message_page);
> -		hv_cpu->hyp_synic_message_page = NULL;
> +		if (hv_cpu->hyp_synic_message_page) {
> +			iounmap(hv_cpu->hyp_synic_message_page);
> +			hv_cpu->hyp_synic_message_page = NULL;
> +		}
>  	} else {
>  		simp.base_simp_gpa = 0;
>  	}
> @@ -379,8 +381,10 @@ void hv_synic_disable_regs(unsigned int cpu)
>  	siefp.siefp_enabled = 0;
> 
>  	if (ms_hyperv.paravisor_present || hv_root_partition()) {
> -		iounmap(hv_cpu->hyp_synic_event_page);
> -		hv_cpu->hyp_synic_event_page = NULL;
> +		if (hv_cpu->hyp_synic_event_page) {
> +			iounmap(hv_cpu->hyp_synic_event_page);
> +			hv_cpu->hyp_synic_event_page = NULL;
> +		}
>  	} else {
>  		siefp.base_siefp_gpa = 0;
>  	}
> --
> 2.43.0

Reviewed-by: Michael Kelley <mhklinux@xxxxxxxxxxx>





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux