Subject: CVE-2022-48793: KVM: x86: nSVM: fix potential NULL derefernce on nested migration

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

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.

The Linux kernel CVE team has assigned CVE-2022-48793 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.13 with commit 232f75d3b4b5 and fixed in 5.15.25 with commit 74b426bea4f7
	Issue introduced in 5.13 with commit 232f75d3b4b5 and fixed in 5.16.11 with commit 352193edda48
	Issue introduced in 5.13 with commit 232f75d3b4b5 and fixed in 5.17 with commit e1779c2714c3

Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to
older supported kernel versions.  The official CVE entry at
	https://cve.org/CVERecord/?id=CVE-2022-48793
will be updated if fixes are backported, please check that for the most
up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
	arch/x86/kvm/svm/nested.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes.  Individual
changes are never tested alone, but rather are part of a larger kernel
release.  Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all.  If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
	https://git.kernel.org/stable/c/74b426bea4f7e3b081add2b88d4fba16d3af7ab6
	https://git.kernel.org/stable/c/352193edda48e08e8824a7ece09aec830a603cfe
	https://git.kernel.org/stable/c/e1779c2714c3023e4629825762bcbc43a3b943df