[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Currently, it is possible to set the mem-max value to value lower than



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a87dc2a55b0a37ab4de84225dad26ead29ccf5bb
# Parent  dfc89d085f6fcb7699a48f12ce553e458af16e43
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@xxxxxxxxxx

diff -r dfc89d085f6f -r a87dc2a55b0a xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     Fri Apr 14 13:24:38 2006
+++ b/xen/common/dom0_ops.c     Sat Apr 15 08:53:27 2006
@@ -585,9 +585,16 @@
         d = find_domain_by_id(op->u.setdomainmaxmem.domain);
         if ( d != NULL )
         {
-            d->max_pages = op->u.setdomainmaxmem.max_memkb >> (PAGE_SHIFT-10);
-            put_domain(d);
-            ret = 0;
+            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);
         }
     }
     break;

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.