diff options
| author | Miaohe Lin <linmiaohe@huawei.com> | 2020-02-21 22:04:46 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-02-28 16:36:14 +0100 |
| commit | 647bdd69c205143bbbd77c1053f6baee1455f434 (patch) | |
| tree | 61169f84027bb07241a0a8d2925f9d05a33c29a7 | |
| parent | e6bff0cdf51c26b6216f45f88e39aa3eb16b2115 (diff) | |
| download | linux-647bdd69c205143bbbd77c1053f6baee1455f434.tar.gz linux-647bdd69c205143bbbd77c1053f6baee1455f434.tar.bz2 linux-647bdd69c205143bbbd77c1053f6baee1455f434.zip | |
KVM: apic: avoid calculating pending eoi from an uninitialized val
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 <vkuznets@redhat.com>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | arch/x86/kvm/lapic.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index d8c3fa015432..537c36b55b5d 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -566,9 +566,11 @@ static inline bool pv_eoi_enabled(struct kvm_vcpu *vcpu) 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; } |
