Commit 6d6cdcaf12560db583b098baca23e3bdab78bcaa

Authored by David Hildenbrand
Committed by Greg Kroah-Hartman
1 parent 6d351caba5

KVM: s390: floating irqs: fix user triggerable endless loop

commit 8e2207cdd087ebb031e9118d1fd0902c6533a5e5 upstream.

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>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff

arch/s390/kvm/interrupt.c
... ... @@ -850,6 +850,8 @@
850 850 list_add_tail(&inti->list, &iter->list);
851 851 }
852 852 atomic_set(&fi->active, 1);
  853 + if (atomic_read(&kvm->online_vcpus) == 0)
  854 + goto unlock_fi;
853 855 sigcpu = find_first_bit(fi->idle_mask, KVM_MAX_VCPUS);
854 856 if (sigcpu == KVM_MAX_VCPUS) {
855 857 do {