Do not mask -ENOMEM or any other error when vcpu_ucontrol_translate() is called. In case of failure, return the error without masking it to -EREMOTE. Fixes: e38c884df921 ("KVM: s390: Switch to new gmap") Cc: stable@vger.kernel.org Signed-off-by: Claudio Imbrenda --- arch/s390/kvm/gmap/gmap.c | 5 ++++- arch/s390/kvm/s390/s390.c | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c index b9d92bef5459..ef1243ad4e54 100644 --- a/arch/s390/kvm/gmap/gmap.c +++ b/arch/s390/kvm/gmap/gmap.c @@ -937,7 +937,10 @@ static int gmap_ucas_translate_simple(struct gmap *gmap, gpa_t *gaddr, union crs * This allows ucontrol VMs to use the normal fault resolution path, like * normal VMs. * - * Return: %0 in case of success, otherwise %-EREMOTE. + * Return: + * * %0 in case of success, + * * %-ENOMEM if running out of memory, + * * otherwise %-EREMOTE. */ int gmap_ucas_translate(struct kvm_s390_mmu_cache *mc, struct gmap *gmap, gpa_t *gaddr) { diff --git a/arch/s390/kvm/s390/s390.c b/arch/s390/kvm/s390/s390.c index 18fb200f854a..cec1278f2ceb 100644 --- a/arch/s390/kvm/s390/s390.c +++ b/arch/s390/kvm/s390/s390.c @@ -4316,8 +4316,9 @@ static int kvm_s390_fixup_prefix(struct kvm_vcpu *vcpu) gfn_t gfn; int rc; - if (vcpu_ucontrol_translate(vcpu, &gaddr)) - return -EREMOTE; + rc = vcpu_ucontrol_translate(vcpu, &gaddr); + if (rc) + return rc; gfn = gpa_to_gfn(gaddr); rc = kvm_s390_faultin_gfn_simple(vcpu, NULL, gfn, true); @@ -4619,8 +4620,9 @@ static int vcpu_dat_fault_handler(struct kvm_vcpu *vcpu, gpa_t gaddr, bool wr) }; int rc; - if (vcpu_ucontrol_translate(vcpu, &gaddr)) - return -EREMOTE; + rc = vcpu_ucontrol_translate(vcpu, &gaddr); + if (rc) + return rc; f.gfn = gpa_to_gfn(gaddr); rc = kvm_s390_faultin_gfn(vcpu, NULL, &f); -- 2.56.1