]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Allocate the lm_root before allocating PAE roots
authorSean Christopherson <seanjc@google.com>
Fri, 5 Mar 2021 01:10:48 +0000 (17:10 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Mar 2021 08:42:16 +0000 (04:42 -0400)
commit331ab27752f1357bae3d55c4ac0b5f89c6a37fcb
tree0b76d8f81869cc7538dc1c7fcb5edfc85bae3d9a
parentf1dc042fc77f573df27d70e93a0162dfbaa86943
KVM: x86/mmu: Allocate the lm_root before allocating PAE roots

Allocate lm_root before the PAE roots so that the PAE roots aren't
leaked if the memory allocation for the lm_root happens to fail.

Note, KVM can still leak PAE roots if mmu_check_root() fails on a guest's
PDPTR, or if mmu_alloc_root() fails due to MMU pages not being available.
Those issues will be fixed in future commits.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210305011101.3597423-5-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c