diff options
-rw-r--r-- | arch/x86/kvm/x86.c | 19 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 2 |
2 files changed, 8 insertions, 13 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 49fa1f0e59bd..40905ce6be0a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -2689,14 +2689,11 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
2689 | break; | 2689 | break; |
2690 | } | 2690 | } |
2691 | case KVM_SET_LAPIC: { | 2691 | case KVM_SET_LAPIC: { |
2692 | r = -EINVAL; | ||
2693 | if (!vcpu->arch.apic) | 2692 | if (!vcpu->arch.apic) |
2694 | goto out; | 2693 | goto out; |
2695 | u.lapic = memdup_user(argp, sizeof(*u.lapic)); | 2694 | u.lapic = memdup_user(argp, sizeof(*u.lapic)); |
2696 | if (IS_ERR(u.lapic)) { | 2695 | if (IS_ERR(u.lapic)) |
2697 | r = PTR_ERR(u.lapic); | 2696 | return PTR_ERR(u.lapic); |
2698 | goto out; | ||
2699 | } | ||
2700 | 2697 | ||
2701 | r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic); | 2698 | r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic); |
2702 | if (r) | 2699 | if (r) |
@@ -2877,10 +2874,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
2877 | } | 2874 | } |
2878 | case KVM_SET_XSAVE: { | 2875 | case KVM_SET_XSAVE: { |
2879 | u.xsave = memdup_user(argp, sizeof(*u.xsave)); | 2876 | u.xsave = memdup_user(argp, sizeof(*u.xsave)); |
2880 | if (IS_ERR(u.xsave)) { | 2877 | if (IS_ERR(u.xsave)) |
2881 | r = PTR_ERR(u.xsave); | 2878 | return PTR_ERR(u.xsave); |
2882 | goto out; | ||
2883 | } | ||
2884 | 2879 | ||
2885 | r = kvm_vcpu_ioctl_x86_set_xsave(vcpu, u.xsave); | 2880 | r = kvm_vcpu_ioctl_x86_set_xsave(vcpu, u.xsave); |
2886 | break; | 2881 | break; |
@@ -2902,10 +2897,8 @@ long kvm_arch_vcpu_ioctl(struct file *filp, | |||
2902 | } | 2897 | } |
2903 | case KVM_SET_XCRS: { | 2898 | case KVM_SET_XCRS: { |
2904 | u.xcrs = memdup_user(argp, sizeof(*u.xcrs)); | 2899 | u.xcrs = memdup_user(argp, sizeof(*u.xcrs)); |
2905 | if (IS_ERR(u.xcrs)) { | 2900 | if (IS_ERR(u.xcrs)) |
2906 | r = PTR_ERR(u.xcrs); | 2901 | return PTR_ERR(u.xcrs); |
2907 | goto out; | ||
2908 | } | ||
2909 | 2902 | ||
2910 | r = kvm_vcpu_ioctl_x86_set_xcrs(vcpu, u.xcrs); | 2903 | r = kvm_vcpu_ioctl_x86_set_xcrs(vcpu, u.xcrs); |
2911 | break; | 2904 | break; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2fb73191801f..316d76aa030d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1954,6 +1954,7 @@ out_free2: | |||
1954 | kvm_sregs = memdup_user(argp, sizeof(*kvm_sregs)); | 1954 | kvm_sregs = memdup_user(argp, sizeof(*kvm_sregs)); |
1955 | if (IS_ERR(kvm_sregs)) { | 1955 | if (IS_ERR(kvm_sregs)) { |
1956 | r = PTR_ERR(kvm_sregs); | 1956 | r = PTR_ERR(kvm_sregs); |
1957 | kvm_sregs = NULL; | ||
1957 | goto out; | 1958 | goto out; |
1958 | } | 1959 | } |
1959 | r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs); | 1960 | r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs); |
@@ -2054,6 +2055,7 @@ out_free2: | |||
2054 | fpu = memdup_user(argp, sizeof(*fpu)); | 2055 | fpu = memdup_user(argp, sizeof(*fpu)); |
2055 | if (IS_ERR(fpu)) { | 2056 | if (IS_ERR(fpu)) { |
2056 | r = PTR_ERR(fpu); | 2057 | r = PTR_ERR(fpu); |
2058 | fpu = NULL; | ||
2057 | goto out; | 2059 | goto out; |
2058 | } | 2060 | } |
2059 | r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu); | 2061 | r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu); |