Return-Path: Received: from mail-pf0-f178.google.com ([209.85.192.178]:34181 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753066AbdDLRox (ORCPT ); Wed, 12 Apr 2017 13:44:53 -0400 Received: by mail-pf0-f178.google.com with SMTP id c198so16983041pfc.1 for ; Wed, 12 Apr 2017 10:44:48 -0700 (PDT) From: Sumit Semwal To: stable@vger.kernel.org Cc: Vitaly Kuznetsov , "K . Y . Srinivasan" , Greg Kroah-Hartman , Sumit Semwal Subject: [v2 PATCH for-4.4 14/16] hv: don't reset hv_context.tsc_page on crash Date: Wed, 12 Apr 2017 23:13:48 +0530 Message-Id: <1492019030-13567-15-git-send-email-sumit.semwal@linaro.org> In-Reply-To: <1492019030-13567-1-git-send-email-sumit.semwal@linaro.org> References: <1492019030-13567-1-git-send-email-sumit.semwal@linaro.org> Sender: stable-owner@vger.kernel.org List-ID: From: Vitaly Kuznetsov [ Upstream commit 56ef6718a1d8d77745033c5291e025ce18504159 ] 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 Signed-off-by: K. Y. Srinivasan Cc: Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sumit Semwal --- drivers/hv/hv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index ddbf7e7..8ce1f2e 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -305,9 +305,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 } -- 2.7.4