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

[Xen-changelog] [xen master] x86/p2m: fix p2m_finish_type_change()



commit 2bad3829a59a9b227ab652d9e152cfb361b5f62c
Author:     Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
AuthorDate: Fri Jan 11 12:28:49 2019 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Jan 11 12:28:49 2019 +0100

    x86/p2m: fix p2m_finish_type_change()
    
    finish_type_change() returns a negative int on error, but the
    current code checks if ( !rc ). We also need to treat
    finish_type_change()'s return codes cumulatively in the
    success case (don't overwrite a 1 returned while processing
    the hostp2m if processing an altp2m returns 0).
    
    The breakage was introduced by commit 0fb4b58c8b
    ("x86/altp2m: fix display frozen when switching to a new view
    early").
    
    Properly indent the out: label while at it.
    
    Signed-off-by: Razvan Cojocaru <rcojocaru@xxxxxxxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxx>
---
 xen/arch/x86/mm/p2m.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 5451f16eff..d14ce57dd5 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1176,7 +1176,7 @@ int p2m_finish_type_change(struct domain *d,
 
     rc = finish_type_change(hostp2m, first_gfn, max_nr);
 
-    if ( !rc )
+    if ( rc < 0 )
         goto out;
 
 #ifdef CONFIG_HVM
@@ -1188,18 +1188,24 @@ int p2m_finish_type_change(struct domain *d,
             if ( d->arch.altp2m_eptp[i] != mfn_x(INVALID_MFN) )
             {
                 struct p2m_domain *altp2m = d->arch.altp2m_p2m[i];
+                int rc1;
 
                 p2m_lock(altp2m);
-                rc = finish_type_change(altp2m, first_gfn, max_nr);
+                rc1 = finish_type_change(altp2m, first_gfn, max_nr);
                 p2m_unlock(altp2m);
 
-                if ( !rc )
+                if ( rc1 < 0 )
+                {
+                    rc = rc1;
                     goto out;
+                }
+
+                rc |= rc1;
             }
     }
 #endif
 
-out:
+ out:
     p2m_unlock(hostp2m);
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.