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

[Xen-changelog] [xen stable-4.7] x86/hvm: Fix altp2m_vcpu_enable_notify error handling



commit 8f140271ef75b1ac20046877f1431f13b90d5b9f
Author:     Adrian Pop <apop@xxxxxxxxxxxxxxx>
AuthorDate: Wed Dec 20 16:18:09 2017 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Dec 20 16:18:09 2017 +0100

    x86/hvm: Fix altp2m_vcpu_enable_notify error handling
    
    The altp2m_vcpu_enable_notify subop handler might skip calling
    rcu_unlock_domain() after rcu_lock_current_domain().  Albeit since both
    rcu functions are no-ops when run on the current domain, this doesn't
    really have repercussions.
    
    The second change is adding a missing break that would have potentially
    enabled #VE for the current domain even if it had intended to enable it
    for another one (not a supported functionality).
    
    Signed-off-by: Adrian Pop <apop@xxxxxxxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: eb0660c6950e08e44fdfeca3e29320382e2a1554
    master date: 2017-11-16 17:25:59 +0000
---
 xen/arch/x86/hvm/hvm.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index db48fd4..2125d40 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -5364,12 +5364,18 @@ static int do_altp2m_op(
 
         if ( a.u.enable_notify.pad || a.domain != DOMID_SELF ||
              a.u.enable_notify.vcpu_id != curr->vcpu_id )
+        {
             rc = -EINVAL;
+            break;
+        }
 
         if ( (gfn_x(vcpu_altp2m(curr).veinfo_gfn) != INVALID_GFN) ||
              (mfn_x(get_gfn_query_unlocked(curr->domain,
                     a.u.enable_notify.gfn, &p2mt)) == INVALID_MFN) )
-            return -EINVAL;
+        {
+            rc = -EINVAL;
+            break;
+        }
 
         vcpu_altp2m(curr).veinfo_gfn = _gfn(a.u.enable_notify.gfn);
         altp2m_vcpu_update_vmfunc_ve(curr);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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