[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140108084242.GA10485@localhost.localdomain>
Date: Wed, 8 Jan 2014 16:42:42 +0800
From: Han Pingtian <hanpt@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: Mel Gorman <mgorman@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
Michal Hocko <mhocko@...e.cz>,
Dave Hansen <dave.hansen@...el.com>,
David Rientjes <rientjes@...gle.com>
Subject: [RFC] mm: prevent set a value less than 0 to min_free_kbytes
If echo -1 > /proc/vm/sys/min_free_kbytes, the system will hang.
Changing proc_dointvec() to proc_dointvec_minmax() in the
min_free_kbytes_sysctl_handler() can prevent this to happen.
Signed-off-by: Han Pingtian <hanpt@...ux.vnet.ibm.com>
---
mm/page_alloc.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 77937e0..a9dcfd8 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5692,7 +5692,12 @@ module_init(init_per_zone_wmark_min)
int min_free_kbytes_sysctl_handler(ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
{
- proc_dointvec(table, write, buffer, length, ppos);
+ int rc;
+
+ rc = proc_dointvec_minmax(table, write, buffer, length, ppos);
+ if (rc)
+ return rc;
+
if (write) {
user_min_free_kbytes = min_free_kbytes;
setup_per_zone_wmarks();
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists