]> xenbits.xensource.com Git - xen.git/commitdiff
xen: Do not accept DOMID_SELF as input to DOMCTL_getdomaininfo.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 14 Aug 2007 08:56:46 +0000 (09:56 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Tue, 14 Aug 2007 08:56:46 +0000 (09:56 +0100)
This was screwing up callers that loop on getdomaininfo(), if there
was a domain with domid DOMID_FIRST_RESERVED-1 (== DOMID_SELF-1).
They would see DOMID_SELF-1, then look up DOMID_SELF, which has domid
0 of course, and then start their domain-finding loop all over again!
Found by Kouya Shimura <kouya@jp.fujitsu.com>. Thanks!
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/domctl.c

index 09a1e84d98e06332382b1aa29da98c4303ee9e81..5d29667b7c3d0842719727c3b2316c002ac53406 100644 (file)
@@ -463,19 +463,13 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
     case XEN_DOMCTL_getdomaininfo:
     { 
         struct domain *d;
-        domid_t dom;
-
-        dom = op->domain;
-        if ( dom == DOMID_SELF )
-            dom = current->domain->domain_id;
+        domid_t dom = op->domain;
 
         rcu_read_lock(&domlist_read_lock);
 
         for_each_domain ( d )
-        {
             if ( d->domain_id >= dom )
                 break;
-        }
 
         if ( d == NULL )
         {