@@ -303,10 +365,26 @@ void vmbus_disconnect(void)The matching memremap() calls are made in vmbus_connect() only in the
vmbus_connection.int_page = NULL;
}
- hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[0]);
- hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[1]);
- vmbus_connection.monitor_pages[0] = NULL;
- vmbus_connection.monitor_pages[1] = NULL;
+ if (hv_is_isolation_supported()) {
+ memunmap(vmbus_connection.monitor_pages[0]);
+ memunmap(vmbus_connection.monitor_pages[1]);
SNP case. In the non-SNP case, monitor_pages and monitor_pages_original
are the same, so you would be doing an unmap, and then doing the
set_memory_encrypted() and hv_free_hyperv_page() using an address
that is no longer mapped, which seems wrong. Looking at memunmap(),
it might be a no-op in this case, but even if it is, making them conditional
on the SNP case might be a safer thing to do, and it would make the code
more symmetrical.