Skip to contentSkip to conversation

KVM: x86/mmu: Passing up the error state of mmu_alloc_shadow_roots()

PATCH Applied Like Xu 3 participants 3 messages Mar 1, 2022

Subsystems (3)
lore
Share & tools
lore

Like Xu

author
#0 lore raw

PATCH 1/1 KVM: x86/mmu: Passing up the error state of mmu_alloc_shadow_roots()

From: Like Xu <[email protected]>

Just like on the optional mmu_alloc_direct_roots() path, once shadow path reaches "r = -EIO" somewhere, the caller needs to know the actual state in order to enter error handling and avoid something worse.

Fixes 4a38162ee9f1 ("KVM: MMU: load PDPTRs outside mmu_lock")
---
 arch/x86/kvm/mmu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu/mmu.c +1 -1
index b2c1c4eb6007..304bfdc50fea 100644
@@ -3533,7 +3533,7 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu)
 out_unlock:
 	write_unlock(&vcpu->kvm->mmu_lock);
 
-	return 0;
+	return r;
 }
 
 static int mmu_alloc_special_roots(struct kvm_vcpu *vcpu)
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Like Xu

From: Like Xu <[email protected]>

Just like on the optional mmu_alloc_direct_roots() path, once shadow path reaches "r = -EIO" somewhere, the caller needs to know the actual state in order to enter error handling and avoid something worse.

Well that's emabarrassing.

Quoted 1 line
Fixes 4a38162ee9f1 ("KVM: MMU: load PDPTRs outside mmu_lock")
Quoted 2 lines

---