aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/page_alloc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index fab9506273be..a662c74a0f5d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3256,18 +3256,25 @@ int numa_zonelist_order_handler(ctl_table *table, int write,
3256 static DEFINE_MUTEX(zl_order_mutex); 3256 static DEFINE_MUTEX(zl_order_mutex);
3257 3257
3258 mutex_lock(&zl_order_mutex); 3258 mutex_lock(&zl_order_mutex);
3259 if (write) 3259 if (write) {
3260 strcpy(saved_string, (char*)table->data); 3260 if (strlen((char *)table->data) >= NUMA_ZONELIST_ORDER_LEN) {
3261 ret = -EINVAL;
3262 goto out;
3263 }
3264 strcpy(saved_string, (char *)table->data);
3265 }
3261 ret = proc_dostring(table, write, buffer, length, ppos); 3266 ret = proc_dostring(table, write, buffer, length, ppos);
3262 if (ret) 3267 if (ret)
3263 goto out; 3268 goto out;
3264 if (write) { 3269 if (write) {
3265 int oldval = user_zonelist_order; 3270 int oldval = user_zonelist_order;
3266 if (__parse_numa_zonelist_order((char*)table->data)) { 3271
3272 ret = __parse_numa_zonelist_order((char *)table->data);
3273 if (ret) {
3267 /* 3274 /*
3268 * bogus value. restore saved string 3275 * bogus value. restore saved string
3269 */ 3276 */
3270 strncpy((char*)table->data, saved_string, 3277 strncpy((char *)table->data, saved_string,
3271 NUMA_ZONELIST_ORDER_LEN); 3278 NUMA_ZONELIST_ORDER_LEN);
3272 user_zonelist_order = oldval; 3279 user_zonelist_order = oldval;
3273 } else if (oldval != user_zonelist_order) { 3280 } else if (oldval != user_zonelist_order) {