Commit cda28549 authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Jiri Slaby

kvm: x86: fix kvm_apic_has_events to check for NULL pointer

commit ce40cd3f upstream.

Malicious (or egregiously buggy) userspace can trigger it, but it
should never happen in normal operation.
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Acked-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent ffe2efe0
...@@ -165,7 +165,7 @@ static inline u16 apic_logical_id(struct kvm_apic_map *map, u32 ldr) ...@@ -165,7 +165,7 @@ static inline u16 apic_logical_id(struct kvm_apic_map *map, u32 ldr)
static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu) static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu)
{ {
return vcpu->arch.apic->pending_events; return kvm_vcpu_has_lapic(vcpu) && vcpu->arch.apic->pending_events;
} }
bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector); bool kvm_apic_pending_eoi(struct kvm_vcpu *vcpu, int vector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment