Mailing List Archive

[xen-unstable] xen: Do not accept DOMID_SELF as input to DOMCTL_getdomaininfo.
# HG changeset patch
# User kfraser@localhost.localdomain
# Date 1187081806 -3600
# Node ID ef79bf6f0142142003681052f925ad8f85b26ab5
# Parent fdffab15499d1f976d41ca0c475e5fae1c2f02ad
xen: Do not accept DOMID_SELF as input to DOMCTL_getdomaininfo.
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 | 8 +-------
1 files changed, 1 insertion(+), 7 deletions(-)

diff -r fdffab15499d -r ef79bf6f0142 xen/common/domctl.c
--- a/xen/common/domctl.c Tue Aug 14 09:21:39 2007 +0100
+++ b/xen/common/domctl.c Tue Aug 14 09:56:46 2007 +0100
@@ -463,19 +463,13 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
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 )
{

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xensource.com
http://lists.xensource.com/xen-changelog