mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-23 19:08:15 -04:00
KVM: s390: Fix handle_{sske,pfmf} under memory pressure
Under heavy memory pressure, handle_sske() and handle_pfmf() might
cause an endless loop if the mmu cache runs empty, the atomic
allocations fail, and the top-up function also fails. While quite
unlikely, that scenario is not impossible.
Fix the issue by not ignoring the return value of
kvm_s390_mmu_cache_topup(), and appropriately returning an error code
in case of failure.
Fixes: e38c884df9 ("KVM: s390: Switch to new gmap")
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-ID: <20260623153331.233784-6-imbrenda@linux.ibm.com>
This commit is contained in:
@@ -366,7 +366,9 @@ static int handle_sske(struct kvm_vcpu *vcpu)
|
||||
if (rc > 1)
|
||||
return kvm_s390_inject_program_int(vcpu, PGM_ADDRESSING);
|
||||
if (rc == -ENOMEM) {
|
||||
kvm_s390_mmu_cache_topup(vcpu->arch.mc);
|
||||
rc = kvm_s390_mmu_cache_topup(vcpu->arch.mc);
|
||||
if (rc)
|
||||
return rc;
|
||||
continue;
|
||||
}
|
||||
if (rc < 0)
|
||||
@@ -1122,7 +1124,9 @@ static int handle_pfmf(struct kvm_vcpu *vcpu)
|
||||
if (rc > 1)
|
||||
return kvm_s390_inject_program_int(vcpu, rc);
|
||||
if (rc == -ENOMEM) {
|
||||
kvm_s390_mmu_cache_topup(vcpu->arch.mc);
|
||||
rc = kvm_s390_mmu_cache_topup(vcpu->arch.mc);
|
||||
if (rc)
|
||||
return rc;
|
||||
continue;
|
||||
}
|
||||
if (rc < 0)
|
||||
|
||||
Reference in New Issue
Block a user