ia64/xen-unstable

changeset 9728:5102cd121a36

Currently, it is possible to set the mem-max value to value lower than
what has been currently allocated to the domain causing the kernel to
crash. This patch validates the value passed in and prevents setting the
value below the current allocation level.

Signed-off-by: ksrinivasan@novell.com
author kaf24@firebug.cl.cam.ac.uk
date Sat Apr 15 09:47:55 2006 +0100 (2006-04-15)
parents 1fe63743a147
children 1d8b3c85121d
files xen/common/dom0_ops.c
line diff
     1.1 --- a/xen/common/dom0_ops.c	Fri Apr 14 21:22:09 2006 +0100
     1.2 +++ b/xen/common/dom0_ops.c	Sat Apr 15 09:47:55 2006 +0100
     1.3 @@ -585,9 +585,16 @@ long do_dom0_op(GUEST_HANDLE(dom0_op_t) 
     1.4          d = find_domain_by_id(op->u.setdomainmaxmem.domain);
     1.5          if ( d != NULL )
     1.6          {
     1.7 -            d->max_pages = op->u.setdomainmaxmem.max_memkb >> (PAGE_SHIFT-10);
     1.8 +            unsigned long new_max;
     1.9 +            new_max = op->u.setdomainmaxmem.max_memkb >> (PAGE_SHIFT-10);
    1.10 +            if (new_max < d->tot_pages) 
    1.11 +                ret = -EINVAL;
    1.12 +            else 
    1.13 +            {  
    1.14 +                d->max_pages = new_max;
    1.15 +                ret = 0;
    1.16 +            }
    1.17              put_domain(d);
    1.18 -            ret = 0;
    1.19          }
    1.20      }
    1.21      break;