Commit 6fc48af8 authored by Tetsuo Handa's avatar Tetsuo Handa Committed by Linus Torvalds

sysctl: check length at deprecated_sysctl_warning

Original patch assumed args->nlen < CTL_MAXNAME, but it can be false.
Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dbd0cf48
...@@ -2620,6 +2620,10 @@ static int deprecated_sysctl_warning(struct __sysctl_args *args) ...@@ -2620,6 +2620,10 @@ static int deprecated_sysctl_warning(struct __sysctl_args *args)
int name[CTL_MAXNAME]; int name[CTL_MAXNAME];
int i; 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 */ /* Read in the sysctl name for better debug message logging */
for (i = 0; i < args->nlen; i++) for (i = 0; i < args->nlen; i++)
if (get_user(name[i], args->name + i)) if (get_user(name[i], args->name + i))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment