From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78CA7C54FC7 for ; Thu, 27 Feb 2020 14:19:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51D4A24697 for ; Thu, 27 Feb 2020 14:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582813152; bh=Jh+a2lBOCKXDBmG/hoPXRf10wziWKNYL5b/JHbzBHys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=SntukoLPlJ3WfVxDB6uwRZbSZBoIazhByBRUhSjHavPVd910f+8T8nkDFiiR6o18S n3WCT/ih8MiFUXN9ioMwBs5sFF7iMpm5HS6HI385efj1QrJ35TNCbGx1DWSzXCCQL9 3p4CtqrXZrb48oBWTK95TxRcGKZSUAbyZ4u9qY+Q= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389980AbgB0OTK (ORCPT ); Thu, 27 Feb 2020 09:19:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:59658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388960AbgB0OTC (ORCPT ); Thu, 27 Feb 2020 09:19:02 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51ADB2469D; Thu, 27 Feb 2020 14:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582813141; bh=Jh+a2lBOCKXDBmG/hoPXRf10wziWKNYL5b/JHbzBHys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhjSM/ppDvkXqUA+edvC5Cn/FRpAav3A9lS7K8TmDFOsrqp1wIsnWCR90srffsJkw 2FJVSg5otDNdcz0fMXX6y7AX1fiw9Nma+rnbKWrvrHYKvD2UrRlMYRkikZ85+UlkW2 sUgq2X94Hq06wSZ7hrlixdzsf0ZLQGCobczUo4k8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Miaohe Lin , Paolo Bonzini Subject: [PATCH 5.5 102/150] KVM: apic: avoid calculating pending eoi from an uninitialized val Date: Thu, 27 Feb 2020 14:37:19 +0100 Message-Id: <20200227132247.843728421@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132232.815448360@linuxfoundation.org> References: <20200227132232.815448360@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miaohe Lin commit 23520b2def95205f132e167cf5b25c609975e959 upstream. When pv_eoi_get_user() fails, 'val' may remain uninitialized and the return value of pv_eoi_get_pending() becomes random. Fix the issue by initializing the variable. Reviewed-by: Vitaly Kuznetsov Signed-off-by: Miaohe Lin Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/lapic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -630,9 +630,11 @@ static inline bool pv_eoi_enabled(struct static bool pv_eoi_get_pending(struct kvm_vcpu *vcpu) { u8 val; - if (pv_eoi_get_user(vcpu, &val) < 0) + if (pv_eoi_get_user(vcpu, &val) < 0) { printk(KERN_WARNING "Can't read EOI MSR value: 0x%llx\n", (unsigned long long)vcpu->arch.pv_eoi.msr_val); + return false; + } return val & 0x1; }