KVM: s390: floating irqs: fix user triggerable endless loop
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Thu, 15 Jan 2015 16:56:18 +0000 (17:56 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 9 Feb 2015 11:44:10 +0000 (12:44 +0100)
If a vm with no VCPUs is created, the injection of a floating irq
leads to an endless loop in the kernel.

Let's skip the search for a destination VCPU for a floating irq if no
VCPUs were created.

Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org # v3.15+
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/interrupt.c

index c34e1d904ff696f2c8707e0f3de7efc3695b9b51..073b5f387d1dd3484186dd69dcfc5aae63d90b21 100644 (file)
@@ -1244,6 +1244,8 @@ static int __inject_vm(struct kvm *kvm, struct kvm_s390_interrupt_info *inti)
                list_add_tail(&inti->list, &iter->list);
        }
        atomic_set(&fi->active, 1);
+       if (atomic_read(&kvm->online_vcpus) == 0)
+               goto unlock_fi;
        sigcpu = find_first_bit(fi->idle_mask, KVM_MAX_VCPUS);
        if (sigcpu == KVM_MAX_VCPUS) {
                do {