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

[Xen-changelog] [xen-unstable] x86: Fix RCU locking in XENMEM_add_to_physmap.



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1321740831 0
# Node ID 335e8273a3f34a5e2972643a028f83684609f1c1
# Parent  fe3e9d0c123cc3184b6e29531e326927a0e4938d
x86: Fix RCU locking in XENMEM_add_to_physmap.

Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r fe3e9d0c123c -r 335e8273a3f3 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Nov 18 13:43:26 2011 +0000
+++ b/xen/arch/x86/mm.c Sat Nov 19 22:13:51 2011 +0000
@@ -4677,8 +4677,9 @@
     return 0;
 }
 
-static int xenmem_add_to_physmap_once(struct domain *d,
-                                      const struct xen_add_to_physmap *xatp)
+static int xenmem_add_to_physmap_once(
+    struct domain *d,
+    const struct xen_add_to_physmap *xatp)
 {
     struct page_info *page = NULL;
     unsigned long gfn = 0; /* gcc ... */
@@ -4728,7 +4729,6 @@
             if ( p2m_is_shared(p2mt) )
             {
                 put_gfn(d, gfn);
-                rcu_unlock_domain(d);
                 return -ENOMEM;
             }
             if ( !get_page_from_pagenr(idx, d) )
@@ -4748,7 +4748,6 @@
         if ( xatp->space == XENMAPSPACE_gmfn ||
              xatp->space == XENMAPSPACE_gmfn_range )
             put_gfn(d, gfn);
-        rcu_unlock_domain(d);
         return -EINVAL;
     }
 
@@ -4786,8 +4785,6 @@
         put_gfn(d, gfn);
     domain_unlock(d);
 
-    rcu_unlock_domain(d);
-
     return rc;
 }
 
@@ -4864,11 +4861,8 @@
 
         if ( xatp.space == XENMAPSPACE_gmfn_range )
         {
-            if ( rc )
-            {
-                if ( copy_to_guest(arg, &xatp, 1) )
-                    return -EFAULT;
-            }
+            if ( rc && copy_to_guest(arg, &xatp, 1) )
+                rc = -EFAULT;
 
             if ( rc == -EAGAIN )
                 rc = hypercall_create_continuation(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
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®.