]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: SVM: Free sev_asid_bitmap during init if SEV setup fails
authorSean Christopherson <seanjc@google.com>
Thu, 22 Apr 2021 02:11:12 +0000 (19:11 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 26 Apr 2021 09:27:14 +0000 (05:27 -0400)
commit116351256922deccf70f44df61f8e83d95926a1c
tree1f2247bb48e4de62ce35c0fa863cb08141a348ca
parent7f696b5cc7b8ae45fcdfa03ee5ef742e83ce6494
KVM: SVM: Free sev_asid_bitmap during init if SEV setup fails

Free sev_asid_bitmap if the reclaim bitmap allocation fails, othwerise
KVM will unnecessarily keep the bitmap when SEV is not fully enabled.

Freeing the page is also necessary to avoid introducing a bug when a
future patch eliminates svm_sev_enabled() in favor of using the global
'sev' flag directly.  While sev_hardware_enabled() checks max_sev_asid,
which is true even if KVM setup fails, 'sev' will be true if and only
if KVM setup fully succeeds.

Fixes: e89026c0575c ("KVM: SVM: Reduce WBINVD/DF_FLUSH invocations")
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210422021125.3417167-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c