]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: nVMX: fix nested_vmx_check_vmptr failure paths under debugging
authorRadim Krčmář <rkrcmar@redhat.com>
Fri, 19 May 2017 13:48:51 +0000 (15:48 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 May 2017 15:17:21 +0000 (17:17 +0200)
commitf193624159b8dade41ef941adde950ed933c7912
tree9e3120f4bc4032961a5219b6aed54cbb28a9b03f
parente9798e9a6a07f24c8f979470c42d1bc61fb1b848
KVM: nVMX: fix nested_vmx_check_vmptr failure paths under debugging

kvm_skip_emulated_instruction() will return 0 if userspace is
single-stepping the guest.

kvm_skip_emulated_instruction() uses return status convention of exit
handler: 0 means "exit to userspace" and 1 means "continue vm entries".
The problem is that nested_vmx_check_vmptr() return status means
something else: 0 is ok, 1 is error.

This means we would continue executing after a failure.  Static checker
noticed it because vmptr was not initialized.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: ab9d41fbb582 ("KVM: x86: Add kvm_skip_emulated_instruction and use it.")
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c