aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Mattson <[email protected]>2019-01-17 11:55:58 -0800
committerPaolo Bonzini <[email protected]>2019-05-01 00:43:44 +0200
commite8ab8d24b488632d07ce5ddb261f1d454114415b (patch)
tree1c9477e16bf77f84c60a6fd4da58eac069005e12
parent6245242d9145815c3f4be71f7d8af858f7c66319 (diff)
KVM: nVMX: Fix size checks in vmx_set_nested_state
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 <[email protected]> Signed-off-by: Jim Mattson <[email protected]> Reviewed-by: Drew Schmitt <[email protected]> Reviewed-by: Marc Orr <[email protected]> Reviewed-by: Peter Shier <[email protected]> Reviewed-by: Krish Sadhukhan <[email protected]> Fixes: 8fcc4b5923af5de58b80b53a069453b135693304 Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
-rw-r--r--arch/x86/kvm/vmx/nested.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 6401eb7ef19c..0c601d079cd2 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -5423,7 +5423,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 != -1ull) {
@@ -5467,7 +5467,7 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu,
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,