Skip to content

Commit c1fc1d2

Browse files
bonzinigregkh
authored andcommitted
kvm: fix page struct leak in handle_vmon
commit 06ce521af9558814b8606c0476c54497cf83a653 upstream. 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 <dvyukov@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> [bwh: Backported to 3.16: use skip_emulated_instruction()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 98c953a commit c1fc1d2

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

arch/x86/kvm/vmx.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6678,14 +6678,20 @@ static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason,
66786678
}
66796679

66806680
page = nested_get_page(vcpu, vmptr);
6681-
if (page == NULL ||
6682-
*(u32 *)kmap(page) != VMCS12_REVISION) {
6681+
if (page == NULL) {
66836682
nested_vmx_failInvalid(vcpu);
6683+
skip_emulated_instruction(vcpu);
6684+
return 1;
6685+
}
6686+
if (*(u32 *)kmap(page) != VMCS12_REVISION) {
66846687
kunmap(page);
6688+
nested_release_page_clean(page);
6689+
nested_vmx_failInvalid(vcpu);
66856690
skip_emulated_instruction(vcpu);
66866691
return 1;
66876692
}
66886693
kunmap(page);
6694+
nested_release_page_clean(page);
66896695
vmx->nested.vmxon_ptr = vmptr;
66906696
break;
66916697
case EXIT_REASON_VMCLEAR:

0 commit comments

Comments
 (0)