# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6cc6b0ec9fa5eb88b8d95c0154b19b3cb5765e0f
# Parent 2538f3f838dc663e3fdcc511f2bbbf4cd3d1a276
Add some bounds checking to values passed when changing the period and
slice of a domain using the sedf scheduler.
Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
diff -r 2538f3f838dc -r 6cc6b0ec9fa5 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c Wed Mar 8 10:18:39 2006
+++ b/xen/common/sched_sedf.c Wed Mar 8 10:48:34 2006
@@ -56,6 +56,12 @@
#define EXTRA_QUANTUM (MICROSECS(500))
#define WEIGHT_PERIOD (MILLISECS(100))
#define WEIGHT_SAFETY (MILLISECS(5))
+
+/* FIXME: need to validate that these are sane */
+#define PERIOD_MAX ULONG_MAX
+#define PERIOD_MIN (MICROSECS(10))
+#define SLICE_MAX ULONG_MAX
+#define SLICE_MIN (MICROSECS(5))
#define IMPLY(a, b) (!(a) || (b))
#define EQ(a, b) ((!!(a)) == (!!(b)))
@@ -1609,7 +1615,10 @@
* Sanity checking: note that disabling extra weight requires
* that we set a non-zero slice.
*/
- if ( (cmd->u.sedf.slice == 0) ||
+ if ( (cmd->u.sedf.period > PERIOD_MAX) ||
+ (cmd->u.sedf.period < PERIOD_MIN) ||
+ (cmd->u.sedf.slice > SLICE_MAX) ||
+ (cmd->u.sedf.slice < SLICE_MIN) ||
(cmd->u.sedf.slice > cmd->u.sedf.period) )
return -EINVAL;
EDOM_INFO(v)->weight = 0;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|