]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
KVM: x86: nSVM: fix potential NULL derefernce on nested migration
authorMaxim Levitsky <mlevitsk@redhat.com>
Mon, 7 Feb 2022 15:54:19 +0000 (17:54 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 8 Feb 2022 18:30:47 +0000 (13:30 -0500)
commite1779c2714c3023e4629825762bcbc43a3b943df
tree0e8ffff7fe123b8e318e7427d4e3d98d79ce7fb2
parentc53bbe2145f51d3bc0438c2db02e737b9b598bf3
KVM: x86: nSVM: fix potential NULL derefernce on nested migration

Turns out that due to review feedback and/or rebases
I accidentally moved the call to nested_svm_load_cr3 to be too early,
before the NPT is enabled, which is very wrong to do.

KVM can't even access guest memory at that point as nested NPT
is needed for that, and of course it won't initialize the walk_mmu,
which is main issue the patch was addressing.

Fix this for real.

Fixes: 232f75d3b4b5 ("KVM: nSVM: call nested_svm_load_cr3 on nested state load")
Cc: stable@vger.kernel.org
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20220207155447.840194-3-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/nested.c