[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.2] x86/domctl: don't ignore errors from vmce_restore_vcpu()



commit d927bc7136accb7fa59928a6872131a84dbadcb9
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Feb 13 10:16:13 2014 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 13 10:16:13 2014 +0100

    x86/domctl: don't ignore errors from vmce_restore_vcpu()
    
    What started out as a simple cleanup patch (eliminating the redundant
    check of domctl->cmd before copying back the output data) revealed a
    bug in the handling of XEN_DOMCTL_set_ext_vcpucontext.
    
    Fix this, retaining the cleanup.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: af172d655c3900822d1f710ac13ee38ee9d482d2
    master date: 2014-02-04 09:22:12 +0100
---
 xen/arch/x86/domctl.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 0592b6e..63e1987 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1101,6 +1101,8 @@ long arch_do_domctl(
                 evc->syscall32_disables_events = 0;
             }
             evc->mcg_cap = v->arch.mcg_cap;
+
+            ret = copy_to_guest(u_domctl, domctl, 1) ? -EFAULT : 0;
         }
         else
         {
@@ -1140,15 +1142,11 @@ long arch_do_domctl(
             if ( evc->size >= offsetof(typeof(*evc), mcg_cap) +
                               sizeof(evc->mcg_cap) )
                 ret = vmce_restore_vcpu(v, evc->mcg_cap);
+            else if ( evc->size <= offsetof(typeof(*evc), mcg_cap) )
+                ret = 0;
         }
-
-        ret = 0;
-
     ext_vcpucontext_out:
         rcu_unlock_domain(d);
-        if ( (domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext) &&
-             copy_to_guest(u_domctl, domctl, 1) )
-            ret = -EFAULT;
     }
     break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.