[PATCH] sysctl: Check length at deprecated_sysctl_warning.

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <akpm@...>
Cc: <ebiederm@...>, <linux-kernel@...>
Date: Monday, November 12, 2007 - 11:07 pm

Andrew, please replace previous patch with this one.
This one returns -ENOTDIR.
----------

Original patch forgot to check args->nlen.
I don't know why args->nlen == CTL_MAXNAME is rejected,
but it has been rejected traditionally.

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>
---

 kernel/sysctl.c |    4 ++++
 1 file changed, 4 insertions(+)

diff -puN kernel/sysctl.c~sysctl-check-length-at-deprecated_sysctl_warning kernel/sysctl.c
--- a/kernel/sysctl.c~sysctl-check-length-at-deprecated_sysctl_warning
+++ a/kernel/sysctl.c
@@ -2609,6 +2609,10 @@ static int deprecated_sysctl_warning(str
 	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))
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] sysctl: Check length at deprecated_sysctl_warning., Eric W. Biederman, (Mon Nov 12, 5:44 am)
[PATCH] sysctl: Check length at deprecated_sysctl_warning., Tetsuo Handa, (Mon Nov 12, 11:07 pm)
Re: [PATCH] sysctl: Check length at deprecated_sysctl_warning., Eric W. Biederman, (Tue Nov 13, 9:24 am)