[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1680564122-30819-1-git-send-email-nunodasneves@linux.microsoft.com>
Date: Mon, 3 Apr 2023 16:22:02 -0700
From: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
To: linux-hyperv@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: mikelley@...rosoft.com, kys@...rosoft.com, wei.liu@...nel.org,
haiyangz@...rosoft.com, decui@...rosoft.com
Subject: [PATCH] Drivers: hv: Do not free synic pages when they were not allocated
In case of root partition or snp, the synic pages are allocated by the
hypervisor instead of the kernel, so they should not be freed.
Signed-off-by: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
---
drivers/hv/hv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index c7f7652932ca..a10cf642c9ad 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -193,8 +193,10 @@ void hv_synic_free(void)
struct hv_per_cpu_context *hv_cpu
= per_cpu_ptr(hv_context.cpu_context, cpu);
- free_page((unsigned long)hv_cpu->synic_event_page);
- free_page((unsigned long)hv_cpu->synic_message_page);
+ if (!hv_isolation_type_snp() && !hv_root_partition) {
+ free_page((unsigned long)hv_cpu->synic_event_page);
+ free_page((unsigned long)hv_cpu->synic_message_page);
+ }
free_page((unsigned long)hv_cpu->post_msg_page);
}
--
2.25.1
Powered by blists - more mailing lists