]> xenbits.xensource.com Git - xen.git/commitdiff
xen: fix XEN_DOMCTL_memory_mapping to not return with domain RCU lock held
authorKeir Fraser <keir@xen.org>
Tue, 18 Jan 2011 09:04:04 +0000 (09:04 +0000)
committerKeir Fraser <keir@xen.org>
Tue, 18 Jan 2011 09:04:04 +0000 (09:04 +0000)
Broken in 20358:ecc649ec3675

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/x86/domctl.c

index 6652aad8afe047f4063a4c6cd435bc0339e720da..6fb5504d783864a09a3c213532fbbdecea07fb16 100644 (file)
@@ -965,15 +965,15 @@ long arch_do_domctl(
         if ( (mfn + nr_mfns - 1) < mfn ) /* wrap? */
             break;
 
-        ret = -ESRCH;
-        if ( unlikely((d = rcu_lock_domain_by_id(domctl->domain)) == NULL) )
-            break;
-
         ret = -EPERM;
         if ( !IS_PRIV(current->domain) &&
              !iomem_access_permitted(current->domain, mfn, mfn + nr_mfns - 1) )
             break;
 
+        ret = -ESRCH;
+        if ( unlikely((d = rcu_lock_domain_by_id(domctl->domain)) == NULL) )
+            break;
+
         ret=0;
         if ( domctl->u.memory_mapping.add_mapping )
         {