Commit 540a3dbc authored by Sean Christopherson's avatar Sean Christopherson Committed by Yu Zhang
Browse files

KVM: nSVM: Use common GPA helper to check for illegal CR3

mainline inclusion
from mainline-v5.12-rc1
commit bbc2c63d
category: feature
bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I7S3VQ
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bbc2c63ddd51cd6d349e3fe0010f9b7b259e58ea



----------------------------------------------------------------------

Replace an open coded check for an invalid CR3 with its equivalent
helper.

No functional change intended.

Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
Message-Id: <20210204000117.3303214-7-seanjc@google.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarYu Zhang <yu.c.zhang@linux.intel.com>
parent f1c52177
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ static inline bool nested_npt_enabled(struct vcpu_svm *svm)
static int nested_svm_load_cr3(struct kvm_vcpu *vcpu, unsigned long cr3,
			       bool nested_npt)
{
	if (cr3 & rsvd_bits(cpuid_maxphyaddr(vcpu), 63))
	if (kvm_vcpu_is_illegal_gpa(vcpu, cr3))
		return -EINVAL;

	if (!nested_npt && is_pae_paging(vcpu) &&