summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2015-09-15 14:41:54 +0800
committerSasha Levin <sasha.levin@oracle.com>2015-10-27 22:12:48 -0400
commitd758df24a58e5160270c74b467dfa6453fceb91b (patch)
treee2bf834c067bda6c6fc0c5f50043870398514b95
parent45258bdd7f2da471c1201443a63765eff1622863 (diff)
downloadlinux-stable-d758df24a58e5160270c74b467dfa6453fceb91b.tar.gz
linux-stable-d758df24a58e5160270c74b467dfa6453fceb91b.tar.bz2
linux-stable-d758df24a58e5160270c74b467dfa6453fceb91b.zip
kvm: don't try to register to KVM_FAST_MMIO_BUS for non mmio eventfd
[ Upstream commit 8453fecbecae26edb3f278627376caab05d9a88d ] We only want zero length mmio eventfd to be registered on KVM_FAST_MMIO_BUS. So check this explicitly when arg->len is zero to make sure this. Cc: stable@vger.kernel.org Cc: Gleb Natapov <gleb@kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--virt/kvm/eventfd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index b0fb390943c6..336a27aba31d 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -850,7 +850,7 @@ kvm_assign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
/* When length is ignored, MMIO is also put on a separate bus, for
* faster lookups.
*/
- if (!args->len && !(args->flags & KVM_IOEVENTFD_FLAG_PIO)) {
+ if (!args->len && bus_idx == KVM_MMIO_BUS) {
ret = kvm_io_bus_register_dev(kvm, KVM_FAST_MMIO_BUS,
p->addr, 0, &p->dev);
if (ret < 0)
@@ -905,7 +905,7 @@ kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
continue;
kvm_io_bus_unregister_dev(kvm, bus_idx, &p->dev);
- if (!p->length) {
+ if (!p->length && p->bus_idx == KVM_MMIO_BUS) {
kvm_io_bus_unregister_dev(kvm, KVM_FAST_MMIO_BUS,
&p->dev);
}