[prev in list] [next in list] [prev in thread] [next in thread]
List: kvm
Subject: [PATCH 2/2] KVM: Don't accept obviously wrong gsi values via KVM_IRQFD
From: Jan H. Schönherr <jschoenh () amazon ! de>
Date: 2017-09-15 16:02:41
Message-ID: 1505491361-28139-2-git-send-email-jschoenh () amazon ! de
[Download RAW message or body]
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>
---
virt/kvm/eventfd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index f2ac53a..c608ab4 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -565,6 +565,8 @@ kvm_irqfd(struct kvm *kvm, struct kvm_irqfd *args)
{
if (args->flags & ~(KVM_IRQFD_FLAG_DEASSIGN | KVM_IRQFD_FLAG_RESAMPLE))
return -EINVAL;
+ if (args->gsi >= KVM_MAX_IRQ_ROUTES)
+ return -EINVAL;
if (args->flags & KVM_IRQFD_FLAG_DEASSIGN)
return kvm_irqfd_deassign(kvm, args);
--
2.3.1.dirty
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic