]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: SEV-ES: fix length of string I/O
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 12 Oct 2021 15:07:59 +0000 (11:07 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Oct 2021 08:47:36 +0000 (04:47 -0400)
The size of the data in the scratch buffer is not divided by the size of
each port I/O operation, so vcpu->arch.pio.count ends up being larger
than it should be by a factor of size.

Cc: stable@vger.kernel.org
Fixes: a15bb587483f ("KVM: SVM: Support string IO operations for an SEV-ES guest")
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c

index c36b5fe4c27ca5bf399db828927ab02e4f7d9ec7..e672493b5d8de46a3f0b16ea08af4add06e5b2fc 100644 (file)
@@ -2583,7 +2583,7 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in)
                return -EINVAL;
 
        return kvm_sev_es_string_io(&svm->vcpu, size, port,
-                                   svm->ghcb_sa, svm->ghcb_sa_len, in);
+                                   svm->ghcb_sa, svm->ghcb_sa_len / size, in);
 }
 
 void sev_es_init_vmcb(struct vcpu_svm *svm)