Skip to content

Commit 06ce521

Browse files
committed
kvm: fix page struct leak in handle_vmon
handle_vmon gets a reference on VMXON region page, but does not release it. Release the reference. Found by syzkaller; based on a patch by Dmitry. Reported-by: Dmitry Vyukov <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent a26d553 commit 06ce521

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

arch/x86/kvm/vmx.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6996,13 +6996,18 @@ static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason,
69966996
}
69976997

69986998
page = nested_get_page(vcpu, vmptr);
6999-
if (page == NULL ||
7000-
*(u32 *)kmap(page) != VMCS12_REVISION) {
6999+
if (page == NULL) {
70017000
nested_vmx_failInvalid(vcpu);
7001+
return kvm_skip_emulated_instruction(vcpu);
7002+
}
7003+
if (*(u32 *)kmap(page) != VMCS12_REVISION) {
70027004
kunmap(page);
7005+
nested_release_page_clean(page);
7006+
nested_vmx_failInvalid(vcpu);
70037007
return kvm_skip_emulated_instruction(vcpu);
70047008
}
70057009
kunmap(page);
7010+
nested_release_page_clean(page);
70067011
vmx->nested.vmxon_ptr = vmptr;
70077012
break;
70087013
case EXIT_REASON_VMCLEAR:

0 commit comments

Comments
 (0)