bitkeeper revision 1.1236.25.6 (4231d11bY0LPS6C3wJjBX-5Tagm2NA)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 11 Mar 2005 17:10:51 +0000 (17:10 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 11 Mar 2005 17:10:51 +0000 (17:10 +0000)
Fix a couple of error paths. Use of domain_crash() probably needs
auditing for safe use, and it may need to do things like forcibly
release the per-domain BIGLOCK.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/mm.c
xen/arch/x86/traps.c

index c127c416f296e420eb65b62a50fc79fd4a67aad3..e07a31f4a3f40c24e0716dd50e4f3bc087e934bd 100644 (file)
@@ -2387,7 +2387,6 @@ void ptwr_flush(const int which)
                    (L1_PAGETABLE_ENTRIES - i) * sizeof(l1_pgentry_t));
             unmap_domain_mem(pl1e);
             ptwr_info[cpu].ptinfo[which].l1va = 0;
-            UNLOCK_BIGLOCK(d);
             domain_crash();
         }
         
index 29dfc518819e1f9d0d2584cb90456f6e68669a73..60a8b74b752107eae6991637710fe464090a9aef 100644 (file)
@@ -1007,6 +1007,7 @@ long do_set_trap_table(trap_info_t *traps)
 {
     trap_info_t cur;
     trap_info_t *dst = current->arch.traps;
+    long rc = 0;
 
     LOCK_BIGLOCK(current->domain);
 
@@ -1014,16 +1015,25 @@ long do_set_trap_table(trap_info_t *traps)
     {
         if ( hypercall_preempt_check() )
         {
-            UNLOCK_BIGLOCK(current->domain);
-            return hypercall1_create_continuation(
+            rc = hypercall1_create_continuation(
                 __HYPERVISOR_set_trap_table, traps);
+            break;
         }
 
-        if ( copy_from_user(&cur, traps, sizeof(cur)) ) return -EFAULT;
+        if ( copy_from_user(&cur, traps, sizeof(cur)) ) 
+        {
+            rc = -EFAULT;
+            break;
+        }
 
-        if ( cur.address == 0 ) break;
+        if ( cur.address == 0 )
+            break;
 
-        if ( !VALID_CODESEL(cur.cs) ) return -EPERM;
+        if ( !VALID_CODESEL(cur.cs) )
+        {
+            rc = -EPERM;
+            break;
+        }
 
         memcpy(dst+cur.vector, &cur, sizeof(cur));
         traps++;
@@ -1031,7 +1041,7 @@ long do_set_trap_table(trap_info_t *traps)
 
     UNLOCK_BIGLOCK(current->domain);
 
-    return 0;
+    return rc;
 }