mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 13:22:57 +00:00
KVM: x86: nSVM: harden svm_free_nested against freeing vmcb02 while still in use
Make sure that KVM uses vmcb01 before freeing nested state, and warn if that is not the case. This is a minimal fix for CVE-2022-3344 making the kernel print a warning instead of a kernel panic. Cc: stable@vger.kernel.org Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20221103141351.50662-3-mlevitsk@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
917401f26a
commit
16ae56d7e0
1 changed files with 3 additions and 0 deletions
|
@ -1125,6 +1125,9 @@ void svm_free_nested(struct vcpu_svm *svm)
|
|||
if (!svm->nested.initialized)
|
||||
return;
|
||||
|
||||
if (WARN_ON_ONCE(svm->vmcb != svm->vmcb01.ptr))
|
||||
svm_switch_vmcb(svm, &svm->vmcb01);
|
||||
|
||||
svm_vcpu_free_msrpm(svm->nested.msrpm);
|
||||
svm->nested.msrpm = NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue