diff options
author | Jan H. Schönherr <jschoenh@amazon.de> | 2017-09-07 14:02:48 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-09-15 10:55:28 -0400 |
commit | 36ae3c0a36b7456432fedce38ae2f7bd3e01a563 (patch) | |
tree | f105afd5971726ea0c85b46fd24f62c7235633cb | |
parent | 51aa68e7d57e3217192d88ce90fd5b8ef29ec94f (diff) |
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 <jschoenh@amazon.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | virt/kvm/eventfd.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index f2ac53ab8243..c608ab495282 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c | |||
@@ -565,6 +565,8 @@ kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args) | |||
565 | { | 565 | { |
566 | if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE)) | 566 | if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE)) |
567 | return -EINVAL; | 567 | return -EINVAL; |
568 | if (args->gsi >= KVM_MAX_IRQ_ROUTES) | ||
569 | return -EINVAL; | ||
568 | 570 | ||
569 | if (args->flags & KVM_IRQFD_FLAG_DEASSIGN) | 571 | if (args->flags & KVM_IRQFD_FLAG_DEASSIGN) |
570 | return kvm_irqfd_deassign(kvm, args); | 572 | return kvm_irqfd_deassign(kvm, args); |