If kvm_s390_handle_pv() call fails its error code gets recorded but execution proceeds as if the call was successful. If the next call to copy_to_user() fails then the original error is overwritten. The follow-up patch adds fatal signal checks during VMA walk, which makes it possible for kvm_s390_handle_pv() to return EINTR error. Without this fix any error including EINTR can be overwritten and original error will be lost. Change error handling for kvm_s390_handle_pv() to alter normal flow once failure happens. This is consistent with how kvm_arch_vm_ioctl handles errors for other ioctl commands. Signed-off-by: Suren Baghdasaryan --- arch/s390/kvm/kvm-s390.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 3eb60aa932ec..ddad08c0926f 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2947,6 +2947,8 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) } /* must be called without kvm->lock */ r = kvm_s390_handle_pv(kvm, &args); + if (r) + break; if (copy_to_user(argp, &args, sizeof(args))) { r = -EFAULT; break; -- 2.53.0.1018.g2bb0e51243-goog