Commit a9496df45fc50af5652fadd52080ddc8889c498a

Authored by David Hildenbrand
Committed by Greg Kroah-Hartman
1 parent f79e5ec9d5

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
... ... @@ -1197,6 +1197,8 @@
1197 1197 list_add_tail(&inti->list, &iter->list);
1198 1198 }
1199 1199 atomic_set(&fi->active, 1);
  1200 + if (atomic_read(&kvm->online_vcpus) == 0)
  1201 + goto unlock_fi;
1200 1202 sigcpu = find_first_bit(fi->idle_mask, KVM_MAX_VCPUS);
1201 1203 if (sigcpu == KVM_MAX_VCPUS) {
1202 1204 do {