Skip to content

Commit 36ae3c0

Browse files
schnhrrbonzini
authored andcommitted
KVM: Don't accept obviously wrong gsi values via KVM_IRQFD
We cannot add routes for gsi values >= KVM_MAX_IRQ_ROUTES -- see kvm_set_irq_routing(). Hence, there is no sense in accepting them via KVM_IRQFD. Prevent them from entering the system in the first place. Signed-off-by: Jan H. Schönherr <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 51aa68e commit 36ae3c0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

virt/kvm/eventfd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,8 @@ kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
565565
{
566566
if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))
567567
return -EINVAL;
568+
if (args->gsi >= KVM_MAX_IRQ_ROUTES)
569+
return -EINVAL;
568570

569571
if (args->flags & KVM_IRQFD_FLAG_DEASSIGN)
570572
return kvm_irqfd_deassign(kvm, args);

0 commit comments

Comments
 (0)