[PATCH v1 5/6] KVM: s390: Add missing srcu in kvm_arch_vcpu_ioctl()

Claudio Imbrenda <[email protected]>
Newsgroups org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-s390
Message-ID <[email protected]>
Like kvm_s390_inject_vcpu(), kvm_s390_set_irq_state() also needs to be
called holding kvm->srcu or the slots lock. When fixing
kvm_s390_inject_vcpu() in a previous patch, the path through
kvm_s390_set_irq_state() was missed.

Fix by taking kvm->srcu in kvm_arch_vcpu_ioctl().

Fixes: ba5c1e9b6cee ("KVM: s390: interrupt subsystem, cpu timer, waitpsw")
Fixes: 062e44a9319f ("KVM: s390: Use srcu in kvm_arch_vcpu_unlocked_ioctl()")
Signed-off-by: Claudio Imbrenda <[email protected]>
---
 arch/s390/kvm/kvm-s390.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 50eb72447fd5..7fb5a566e2d8 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -5697,9 +5697,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 			break;
 		}
 		/* do not use irq_state.flags, it will break old QEMUs */
-		r = kvm_s390_set_irq_state(vcpu,
-					   (void __user *) irq_state.buf,
-					   irq_state.len);
+		scoped_guard(srcu, &vcpu->kvm->srcu) {
+			r = kvm_s390_set_irq_state(vcpu, (void __user *)irq_state.buf,
+						   irq_state.len);
+		}
 		break;
 	}
 	case KVM_S390_GET_IRQ_STATE: {
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.