aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAmerigo Wang <amwang@redhat.com>2009-12-14 20:59:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-15 11:53:23 -0500
commit70da2340fbc68e91e701762f785479ab495a0869 (patch)
treef55055a8fa8cb8e00b72ae8f3629dc884515f5e9 /kernel
parentf096e59e844ba3c5d5a7b54b3deafd2aeeebf921 (diff)
'sysctl_max_map_count' should be non-negative
Jan Engelhardt reported we have this problem: setting max_map_count to a value large enough results in programs dying at first try. This is on 2.6.31.6: 15:59 borg:/proc/sys/vm # echo $[1<<31-1] >max_map_count 15:59 borg:/proc/sys/vm # cat max_map_count 1073741824 15:59 borg:/proc/sys/vm # echo $[1<<31] >max_map_count 15:59 borg:/proc/sys/vm # cat max_map_count Killed This is because we have a chance to make 'max_map_count' negative. but it's meaningless. Make it only accept non-negative values. Reported-by: Jan Engelhardt <jengelh@medozas.de> Signed-off-by: WANG Cong <amwang@redhat.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: James Morris <jmorris@namei.org> Cc: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sysctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 60fc93131095..45e4bef0012a 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1131,7 +1131,8 @@ static struct ctl_table vm_table[] = {
1131 .data = &sysctl_max_map_count, 1131 .data = &sysctl_max_map_count,
1132 .maxlen = sizeof(sysctl_max_map_count), 1132 .maxlen = sizeof(sysctl_max_map_count),
1133 .mode = 0644, 1133 .mode = 0644,
1134 .proc_handler = proc_dointvec 1134 .proc_handler = proc_dointvec,
1135 .extra1 = &zero,
1135 }, 1136 },
1136#else 1137#else
1137 { 1138 {