KVM: Fix buffer overflow in kvm_set_irq()
authorAvi Kivity <avi@redhat.com>
Sun, 22 Apr 2012 14:02:11 +0000 (17:02 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Feb 2014 18:45:33 +0000 (10:45 -0800)
commitec90b6113735a9f9fcb64a604b28f446fe03ded2
tree07c0fadb0081f3f0331eacaf721c746c9a399693
parent230a0c3b5881b5493c06d382d799305b4ee603c5
KVM: Fix buffer overflow in kvm_set_irq()

commit f2ebd422f71cda9c791f76f85d2ca102ae34a1ed upstream.

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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Cc: Li Zefan <lizefan@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
virt/kvm/irq_comm.c