KVM: s390: Use srcu in kvm_arch_vcpu_unlocked_ioctl()

kvm_arch_vcpu_unlocked_ioctl() is called without further locks held, but
kvm_s390_inject_vcpu(), which is called from there, needs either the
kvm->srcu or the slots lock.

Fix by taking the kvm->srcu in kvm_arch_vcpu_unlocked_ioctl().

Fixes: ba5c1e9b6c ("KVM: s390: interrupt subsystem, cpu timer, waitpsw")
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-ID: <20260812104436.109741-3-imbrenda@linux.ibm.com>
This commit is contained in:
Claudio Imbrenda 2026-08-12 12:44:29 +02:00
parent 88e22ffd1e
commit 062e44a931

View File

@ -5456,7 +5456,8 @@ long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
if (copy_from_user(&s390irq, argp, sizeof(s390irq)))
return -EFAULT;
rc = kvm_s390_inject_vcpu(vcpu, &s390irq);
scoped_guard(srcu, &vcpu->kvm->srcu)
rc = kvm_s390_inject_vcpu(vcpu, &s390irq);
break;
}
case KVM_S390_INTERRUPT: {
@ -5469,7 +5470,8 @@ long kvm_arch_vcpu_unlocked_ioctl(struct file *filp, unsigned int ioctl,
return -EFAULT;
if (s390int_to_s390irq(&s390int, &s390irq))
return -EINVAL;
rc = kvm_s390_inject_vcpu(vcpu, &s390irq);
scoped_guard(srcu, &vcpu->kvm->srcu)
rc = kvm_s390_inject_vcpu(vcpu, &s390irq);
break;
}
default: