Skip to content

Commit f2ebd42

Browse files
committed
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>
1 parent 99becf1 commit f2ebd42

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎virt/kvm/irq_comm.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ static int setup_routing_entry(struct kvm_irq_routing_table *rt,
332332
*/
333333
hlist_for_each_entry(ei, n, &rt->map[ue->gsi], link)
334334
if (ei->type == KVM_IRQ_ROUTING_MSI ||
335+
ue->type == KVM_IRQ_ROUTING_MSI ||
335336
ue->u.irqchip.irqchip == ei->irqchip.irqchip)
336337
return r;
337338

0 commit comments

Comments
 (0)