mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
KVM: nVMX: Fix size checks in vmx_set_nested_state
commite8ab8d24b4
upstream. The size checks in vmx_nested_state are wrong because the calculations are made based on the size of a pointer to a struct kvm_nested_state rather than the size of a struct kvm_nested_state. Reported-by: Felix Wilhelm <fwilhelm@google.com> Signed-off-by: Jim Mattson <jmattson@google.com> Reviewed-by: Drew Schmitt <dasch@google.com> Reviewed-by: Marc Orr <marcorr@google.com> Reviewed-by: Peter Shier <pshier@google.com> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com> Fixes:8fcc4b5923
Cc: stable@ver.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
499bbe739d
commit
68d49ff477
1 changed files with 2 additions and 2 deletions
|
@ -14236,7 +14236,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
|
|||
return ret;
|
||||
|
||||
/* Empty 'VMXON' state is permitted */
|
||||
if (kvm_state->size < sizeof(kvm_state) + sizeof(*vmcs12))
|
||||
if (kvm_state->size < sizeof(*kvm_state) + sizeof(*vmcs12))
|
||||
return 0;
|
||||
|
||||
if (kvm_state->vmx.vmcs_pa == kvm_state->vmx.vmxon_pa ||
|
||||
|
@ -14269,7 +14269,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
|
|||
if (nested_cpu_has_shadow_vmcs(vmcs12) &&
|
||||
vmcs12->vmcs_link_pointer != -1ull) {
|
||||
struct vmcs12 *shadow_vmcs12 = get_shadow_vmcs12(vcpu);
|
||||
if (kvm_state->size < sizeof(kvm_state) + 2 * sizeof(*vmcs12))
|
||||
if (kvm_state->size < sizeof(*kvm_state) + 2 * sizeof(*vmcs12))
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(shadow_vmcs12,
|
||||
|
|
Loading…
Reference in a new issue