x86/hyperv: Fix kernel panic when kexec on HyperV
[sfrench/cifs-2.6.git] / arch / x86 / hyperv / hv_init.c
index 7abb09e2eeb819129c6e9bcbbc1a3408e3e59c95..d3f42b6bbdac96085dc6d84c1551395c1cfbcb67 100644 (file)
@@ -406,6 +406,13 @@ void hyperv_cleanup(void)
        /* Reset our OS id */
        wrmsrl(HV_X64_MSR_GUEST_OS_ID, 0);
 
+       /*
+        * Reset hypercall page reference before reset the page,
+        * let hypercall operations fail safely rather than
+        * panic the kernel for using invalid hypercall page
+        */
+       hv_hypercall_pg = NULL;
+
        /* Reset the hypercall page */
        hypercall_msr.as_uint64 = 0;
        wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64);