diff options
| author | Roman Kisel <romank@linux.microsoft.com> | 2025-10-08 16:34:12 -0700 |
|---|---|---|
| committer | Wei Liu <wei.liu@kernel.org> | 2025-11-15 06:18:15 +0000 |
| commit | 09406f2f8466fe44894f444943134a09c8519e4f (patch) | |
| tree | 394025012434ccb31b53de90c61591d75d1a9a4a | |
| parent | 1bb15327d529a4e30f69b6c3486dfe8d7a753ff5 (diff) | |
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 <romank@linux.microsoft.com>
Reviewed-by: Tianyu Lan <tiala@microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
| -rw-r--r-- | drivers/hv/hv.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index e9e1edd75107..77da2d211378 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; } |
