[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Fix SETMAXMEM dom0_op with proper locking.
# HG changeset patch # User kaf24@xxxxxxxxxxxxxxxxxxxx # Node ID 1d8b3c85121de189882dee5e2dae54697cf52499 # Parent 5102cd121a360fd38e9792356a62f187599ef9ba Fix SETMAXMEM dom0_op with proper locking. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> diff -r 5102cd121a36 -r 1d8b3c85121d xen/common/dom0_ops.c --- a/xen/common/dom0_ops.c Sat Apr 15 08:47:55 2006 +++ b/xen/common/dom0_ops.c Sat Apr 15 08:52:32 2006 @@ -581,27 +581,31 @@ case DOM0_SETDOMAINMAXMEM: { struct domain *d; + unsigned long new_max; + ret = -ESRCH; d = find_domain_by_id(op->u.setdomainmaxmem.domain); - if ( d != NULL ) - { - unsigned long new_max; - new_max = op->u.setdomainmaxmem.max_memkb >> (PAGE_SHIFT-10); - if (new_max < d->tot_pages) - ret = -EINVAL; - else - { - d->max_pages = new_max; - ret = 0; - } - put_domain(d); - } + if ( d == NULL ) + break; + + ret = -EINVAL; + new_max = op->u.setdomainmaxmem.max_memkb >> (PAGE_SHIFT-10); + + spin_lock(&d->page_alloc_lock); + if ( new_max >= d->tot_pages ) + { + d->max_pages = new_max; + ret = 0; + } + spin_unlock(&d->page_alloc_lock); + + put_domain(d); } break; case DOM0_SETDOMAINHANDLE: { - struct domain *d; + struct domain *d; ret = -ESRCH; d = find_domain_by_id(op->u.setdomainhandle.domain); if ( d != NULL ) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |