From: Roman Kisel Date: Wed, 8 Oct 2025 23:34:12 +0000 (-0700) Subject: Drivers: hv: Check message and event pages for non-NULL before iounmap() X-Git-Tag: v6.19-rc1~56^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09406f2f8466fe44894f444943134a09c8519e4f;p=thirdparty%2Fkernel%2Flinux.git Drivers: hv: Check message and event pages for non-NULL before iounmap() It might happen that some hyp SynIC pages aren't allocated. Check for that and only then call iounmap(). Signed-off-by: Roman Kisel Reviewed-by: Tianyu Lan Reviewed-by: Michael Kelley Signed-off-by: Wei Liu --- diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index e9e1edd751079..77da2d2113789 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -371,8 +371,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; } @@ -383,8 +385,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; }