]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
hv: don't reset hv_context.tsc_page on crash
authorVitaly Kuznetsov <vkuznets@redhat.com>
Wed, 7 Dec 2016 09:16:27 +0000 (01:16 -0800)
committerTim Gardner <tim.gardner@canonical.com>
Mon, 20 Feb 2017 03:57:58 +0000 (20:57 -0700)
BugLink: http://bugs.launchpad.net/bugs/1630924
It may happen that secondary CPUs are still alive and resetting
hv_context.tsc_page will cause a consequent crash in read_hv_clock_tsc()
as we don't check for it being not NULL there. It is safe as we're not
freeing this page anyways.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from linux-next commit 56ef6718a1d8d77745033c5291e025ce18504159)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/hv/hv.c

index 43e17c71f96df8bf6081b2c4b43ec501ee31fe8b..580d6b5e8177cf001870e5bfec3dcf21b2636d29 100644 (file)
@@ -317,9 +317,10 @@ void hv_cleanup(bool crash)
 
                hypercall_msr.as_uint64 = 0;
                wrmsrl(HV_X64_MSR_REFERENCE_TSC, hypercall_msr.as_uint64);
-               if (!crash)
+               if (!crash) {
                        vfree(hv_context.tsc_page);
-               hv_context.tsc_page = NULL;
+                       hv_context.tsc_page = NULL;
+               }
        }
 #endif
 }