Merge branch 'for-4.9/block-irq' of git://git.kernel.dk/linux-block
[cascardo/linux.git] / drivers / hv / hv.c
index a1c086b..60dbd6c 100644 (file)
@@ -278,7 +278,7 @@ cleanup:
  *
  * This routine is called normally during driver unloading or exiting.
  */
-void hv_cleanup(void)
+void hv_cleanup(bool crash)
 {
        union hv_x64_msr_hypercall_contents hypercall_msr;
 
@@ -288,7 +288,8 @@ void hv_cleanup(void)
        if (hv_context.hypercall_page) {
                hypercall_msr.as_uint64 = 0;
                wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);
-               vfree(hv_context.hypercall_page);
+               if (!crash)
+                       vfree(hv_context.hypercall_page);
                hv_context.hypercall_page = NULL;
        }
 
@@ -308,7 +309,8 @@ void hv_cleanup(void)
 
                hypercall_msr.as_uint64 = 0;
                wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
-               vfree(hv_context.tsc_page);
+               if (!crash)
+                       vfree(hv_context.tsc_page);
                hv_context.tsc_page = NULL;
        }
 #endif