Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932267AbcLGHgi (ORCPT ); Wed, 7 Dec 2016 02:36:38 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:46818 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752190AbcLGHeo (ORCPT ); Wed, 7 Dec 2016 02:34:44 -0500 x-originating-ip: 72.167.245.219 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com Cc: "K. Y. Srinivasan" , Subject: [PATCH 4/5] hv: don't reset hv_context.tsc_page on crash Date: Wed, 7 Dec 2016 01:16:27 -0800 Message-Id: <1481102188-4414-4-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1481102188-4414-1-git-send-email-kys@exchange.microsoft.com> References: <1481102113-4365-1-git-send-email-kys@exchange.microsoft.com> <1481102188-4414-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfHQoBW7G7FMT+0MoOjWVo3CyhffduMMHCu1Smf7yldK1o9BXN+QPkks3q9Bz7m3D3c8GKIF2YcOkR8G5Bn1SxbPJGbDyO+8Jknf2GEUyolmJZg6A36u1 gMTt2Y49+sLA2tXw8HAxg87kvJjVz1bfd/LuQgZJKNs2TDyRhxZt4O9e/EAwBUrHNX9UjFJOWA83nJ3QMWLxW9ZpboSj1YMJ2012O28E78zwm+g32tmX2jTe uUm+wFmm00cgodvnFiMKA+hAP7RVa1tNBUWYbwa/+x8Ckbxui8gbj7QNdGoUE5q7zClvjSc9iRr4PDH0RpRodkJ/YcpwPPEjanh4EqJzkg0d66Yxe/L7krsC KV2KGsUK6ixTwBDF7B/8E8KnK+2oDi3Vn66MhiO2cYw/hf9PzDP80q7dLNOrgq+RZ0meVxyEtODqqwCNJ90Pe+vPcyl6ivDqOewqNkUOv4xR+jtdsWbObQCN /B542pluSIhAqQgKrNk75/jy8kw7rcerZ7kzag== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 927 Lines: 33 From: Vitaly Kuznetsov 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: --- drivers/hv/hv.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index c11393c..60f14c4 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -309,9 +309,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 } -- 1.7.4.1