aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/res_counter.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index 3f0417f97e7..085d3ae478f 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -195,6 +195,10 @@ int res_counter_memparse_write_strategy(const char *buf,
if (*end != '\0')
return -EINVAL;
- *res = PAGE_ALIGN(*res);
+ if (PAGE_ALIGN(*res) >= *res)
+ *res = PAGE_ALIGN(*res);
+ else
+ *res = RES_COUNTER_MAX;
+
return 0;
}