summaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-04-22 17:02:11 +0300
committerAvi Kivity <avi@redhat.com>2012-06-05 16:39:58 +0300
commitf2ebd422f71cda9c791f76f85d2ca102ae34a1ed (patch)
tree79944d1c2e3a879b320c0ac2ead230eb655573ca /virt/kvm
parent99becf1328d8d71dd6f4480e3591d7dcdb389e57 (diff)
downloadop-kernel-dev-f2ebd422f71cda9c791f76f85d2ca102ae34a1ed.zip
op-kernel-dev-f2ebd422f71cda9c791f76f85d2ca102ae34a1ed.tar.gz
KVM: Fix buffer overflow in kvm_set_irq()
kvm_set_irq() has an internal buffer of three irq routing entries, allowing connecting a GSI to three IRQ chips or on MSI. However setup_routing_entry() does not properly enforce this, allowing three irqchip routes followed by an MSI route to overflow the buffer. Fix by ensuring that an MSI entry is added to an empty list. Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/irq_comm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index a6a0365..5afb431 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -332,6 +332,7 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
*/
hlist_for_each_entry(ei, n, &rt->map[ue->gsi], link)
if (ei->type == KVM_IRQ_ROUTING_MSI ||
+ ue->type == KVM_IRQ_ROUTING_MSI ||
ue->u.irqchip.irqchip == ei->irqchip.irqchip)
return r;
OpenPOWER on IntegriCloud