diff options
author | Guo Chao <yan@linux.vnet.ibm.com> | 2012-11-02 06:33:21 -0400 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2012-11-13 19:14:28 -0500 |
commit | 18595411a7146330ec19adf0b9db8e6736c84a4e (patch) | |
tree | e92309d75edc34d48830b5d7712876a03dbde5c0 /arch/x86/kvm/x86.c | |
parent | f026399fc90655ac444c62139aa4f8a02e1c795a (diff) |
KVM: do not kfree error pointer
We should avoid kfree()ing error pointer in kvm_vcpu_ioctl() and
kvm_arch_vcpu_ioctl().
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 19 |
1 files changed, 6 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; |