Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
KVM: PPC: Book3S: Don't crash if irqfd used with no in-kernel XICS em…
Browse files Browse the repository at this point in the history
…ulation

It turns out that if userspace creates a pseries-type VM without
in-kernel XICS (interrupt controller) emulation, and then connects
an eventfd to the VM as an irqfd, and the eventfd gets signalled,
that the code will try to deliver an interrupt via the non-existent
XICS object and crash the host kernel with a NULL pointer dereference.

To fix this, we check for the presence of the XICS object before
trying to deliver the interrupt, and return with an error if not.

Signed-off-by: Paul Mackerras <[email protected]>
  • Loading branch information
paulusmack committed Aug 19, 2016
1 parent 694d0d0 commit e48ba1c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/powerpc/kvm/book3s_xics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,6 +1252,8 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
{
struct kvmppc_xics *xics = kvm->arch.xics;

if (!xics)
return -ENODEV;
return ics_deliver_irq(xics, irq, level);
}

Expand Down

0 comments on commit e48ba1c

Please sign in to comment.