From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Michal Hocko <mhocko@suse.cz>,
Dave Hansen <dave.hansen@intel.com>,
David Rientjes <rientjes@google.com>
Subject: [RFC] mm: prevent set a value less than 0 to min_free_kbytes
Date: Wed, 8 Jan 2014 16:42:42 +0800 [thread overview]
Message-ID: <20140108084242.GA10485@localhost.localdomain> (raw)
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@linux.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Michal Hocko <mhocko@suse.cz>,
Dave Hansen <dave.hansen@intel.com>,
David Rientjes <rientjes@google.com>
Subject: [RFC] mm: prevent set a value less than 0 to min_free_kbytes
Date: Wed, 8 Jan 2014 16:42:42 +0800 [thread overview]
Message-ID: <20140108084242.GA10485@localhost.localdomain> (raw)
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@linux.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
next reply other threads:[~2014-01-08 8:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 8:42 Han Pingtian [this message]
2014-01-08 8:42 ` [RFC] mm: prevent set a value less than 0 to min_free_kbytes Han Pingtian
2014-01-08 9:40 ` Michal Hocko
2014-01-08 9:40 ` Michal Hocko
2014-01-09 2:26 ` David Rientjes
2014-01-09 2:26 ` David Rientjes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140108084242.GA10485@localhost.localdomain \
--to=hanpt@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=rientjes@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.