aboutsummaryrefslogtreecommitdiff
path: root/kernel/sysctl.c
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>2007-11-14 16:58:38 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 18:45:37 -0800
commit6fc48af82cef55546d640778698943b6227b7fb0 (patch)
treeb47f618967576fecae480caedabcd45c88073541 /kernel/sysctl.c
parentdbd0cf48842700c3a694dcd32b29e63e27f37acc (diff)
sysctl: check length at deprecated_sysctl_warning
Original patch assumed args->nlen < CTL_MAXNAME, but it can be false. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r--kernel/sysctl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 3a1744fed2b..0deed82a615 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -2620,6 +2620,10 @@ static int deprecated_sysctl_warning(struct __sysctl_args *args)
int name[CTL_MAXNAME];
int i;
+ /* Check args->nlen. */
+ if (args->nlen < 0 || args->nlen > CTL_MAXNAME)
+ return -ENOTDIR;
+
/* Read in the sysctl name for better debug message logging */
for (i = 0; i < args->nlen; i++)
if (get_user(name[i], args->name + i))