Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1160323ybf; Thu, 27 Feb 2020 06:07:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxPJmA7ZvADKxkt7N/WPtKvO7jK48Z4M/SHcFVsZ0sAPLBxcrGeijvmO3F/6cEcvRnoGNrr X-Received: by 2002:a05:6830:1643:: with SMTP id h3mr3353978otr.70.1582812460983; Thu, 27 Feb 2020 06:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582812460; cv=none; d=google.com; s=arc-20160816; b=ZN4KIljxXtnv3/9ovrS/4RXTwWBlpEGEYz0A6XcqpWtQLRPzflzJ6N2cUun8WPzw13 YtA6amS5FvWqWRP2WMoJ5V284ufkrGDRh2kD1ZS5NLFBKNziTUkwS3aNpKPTYZ62DpK8 vSUoJkOTIx3xwA6I9auRv9vVkVURQBNXTFemDrkyhtcG6GI3uqHcKc+0f77ehkXiyTS2 ODwuLmvjilYn9tUrmcolh/DqiZ3Nk1vZnPiL0hjjm7mRcgcqr4yHcYjMjFSJAKxsDZza W+2CtJ2axng3sR1YrT8vZ0r/uzOoVVZTr3TjStXIwtVfn69GcpGa1ej3uel0vNfNp3f/ 8fuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=beTctkCjABCs/NHsf7fpZUrwWgFvLRAVCaCMDl2nJ7E=; b=H0NF7zZstg0qwuh8Jvzw2p7EkZObDLajDC8e1kxznRXNm+AT+EECyRjhdejBPyyXFI jGEKgMnGUDXChbF5Gj5ncAMBH5PZkXspK/3i0ze9d+6P9SQ7/eFUer57ZVbv2pkcGA/X pnCkwHrmUgh9iSuz7FBxLNkWptnc9k9U4F2agkdqh9A1K+KdC1H3x2yUqccr8a2MBlzM GFeXGs1aATPaAFnedPb+jk/lCwG66e6bIPnUT5hdIfeUfRJhXTbyqq6Z9jZb+RfOnA3M PcCPYIq25bLuRmCEnU1fOzLObU44OEDekdJkXH25nTysUKH/RW2I5F8ohgnDic+PotVd f+zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MBYln0I8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si1402722oie.22.2020.02.27.06.07.18; Thu, 27 Feb 2020 06:07:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MBYln0I8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387784AbgB0OFe (ORCPT + 99 others); Thu, 27 Feb 2020 09:05:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:42208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387777AbgB0OFa (ORCPT ); Thu, 27 Feb 2020 09:05:30 -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 9D8BE20578; Thu, 27 Feb 2020 14:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582812330; bh=tv7oqiBsCZdrCegQgEvHRYMt6M59ibt4cgkGfQBEUjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MBYln0I8sbGSsWbJIBvWJ1qmfZV0SKmkSsv6voFrGfLhPMrMZ17bVP3QzVNi4m7Ch nd97zp8ZZ5TWjrJi6tA8edPn9fpbDqi2LyAruHjGwWLbkaFo8ah+i6LP5APz7iEunz g7g1uMb2hIquHSNUd79AATQceaLU3DFSysp+/k3k= 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 4.19 74/97] KVM: apic: avoid calculating pending eoi from an uninitialized val Date: Thu, 27 Feb 2020 14:37:22 +0100 Message-Id: <20200227132226.570161039@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200227132214.553656188@linuxfoundation.org> References: <20200227132214.553656188@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 @@ -633,9 +633,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) { apic_debug("Can't read EOI MSR value: 0x%llx\n", (unsigned long long)vcpu->arch.pv_eoi.msr_val); + return false; + } return val & 0x1; }