diff mbox series

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

Message ID 20220301124941.48412-1-likexu@tencent.com (mailing list archive)
State New, archived
Headers show
Series KVM: x86/mmu: Passing up the error state of mmu_alloc_shadow_roots() | expand

Commit Message

Like Xu March 1, 2022, 12:49 p.m. UTC
From: Like Xu <likexu@tencent.com>

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")
Signed-off-by: Like Xu <likexu@tencent.com>
---
 arch/x86/kvm/mmu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sean Christopherson March 1, 2022, 3:47 p.m. UTC | #1
On Tue, Mar 01, 2022, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> 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.

> Fixes: 4a38162ee9f1 ("KVM: MMU: load PDPTRs outside mmu_lock")

Cc: stable@vger.kernel.org

> Signed-off-by: Like Xu <likexu@tencent.com>
> ---

Reviewed-by: Sean Christopherson <seanjc@google.com>
Paolo Bonzini March 1, 2022, 8:16 p.m. UTC | #2
Queued, thanks.

Paolo
diff mbox series

Patch

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index b2c1c4eb6007..304bfdc50fea 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -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)