Skip to content

Commit 37b9595

Browse files
lantianyurkrcmar
authored andcommitted
KVM/x86: Fix wrong macro references of X86_CR0_PG_BIT and X86_CR4_PAE_BIT in kvm_valid_sregs()
kvm_valid_sregs() should use X86_CR0_PG and X86_CR4_PAE to check bit status rather than X86_CR0_PG_BIT and X86_CR4_PAE_BIT. This patch is to fix it. Fixes: f298103(KVM/x86: Check input paging mode when cs.l is set) Reported-by: Jeremi Piotrowski <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Radim Krčmář <[email protected]> Signed-off-by: Tianyu Lan <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
1 parent f44efa5 commit 37b9595

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7496,13 +7496,13 @@ EXPORT_SYMBOL_GPL(kvm_task_switch);
74967496

74977497
int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
74987498
{
7499-
if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG_BIT)) {
7499+
if ((sregs->efer & EFER_LME) && (sregs->cr0 & X86_CR0_PG)) {
75007500
/*
75017501
* When EFER.LME and CR0.PG are set, the processor is in
75027502
* 64-bit mode (though maybe in a 32-bit code segment).
75037503
* CR4.PAE and EFER.LMA must be set.
75047504
*/
7505-
if (!(sregs->cr4 & X86_CR4_PAE_BIT)
7505+
if (!(sregs->cr4 & X86_CR4_PAE)
75067506
|| !(sregs->efer & EFER_LMA))
75077507
return -EINVAL;
75087508
} else {

0 commit comments

Comments
 (0)