Skip to content

Commit ce40cd3

Browse files
committed
kvm: x86: fix kvm_apic_has_events to check for NULL pointer
Malicious (or egregiously buggy) userspace can trigger it, but it should never happen in normal operation. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent e194bbd commit ce40cd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/lapic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static inline bool kvm_apic_vid_enabled(struct kvm *kvm)
150150

151151
static inline bool kvm_apic_has_events(struct kvm_vcpu *vcpu)
152152
{
153-
return vcpu->arch.apic->pending_events;
153+
return kvm_vcpu_has_lapic(vcpu) && vcpu->arch.apic->pending_events;
154154
}
155155

156156
static inline bool kvm_lowest_prio_delivery(struct kvm_lapic_irq *irq)

0 commit comments

Comments
 (0)