[PATCH] sysctl: Check length at deprecated_sysctl_warning.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tetsuo Handa
Date: Wednesday, November 7, 2007 - 7:57 pm

Original patch assumed args->nlen < CTL_MAXNAME, but it can be false.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>


--- linux-2.6.22-rc2.orig/kernel/sysctl.c	2007-11-08 10:38:17.000000000 +0900
+++ linux-2.6.22-rc2/kernel/sysctl.c	2007-11-08 11:24:27.000000000 +0900
@@ -2609,6 +2609,10 @@ static int deprecated_sysctl_warning(str
 	int name[CTL_MAXNAME];
 	int i;
 
+	/* Check args->nlen. */
+	if (args->nlen > CTL_MAXNAME)
+		return -EFAULT;
+
 	/* 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:
[PATCH] sysctl: Check length at deprecated_sysctl_warning., Tetsuo Handa, (Wed Nov 7, 7:57 pm)
Re: [PATCH] sysctl: Check length at deprecated_sysctl_warning., Eric W. Biederman, (Mon Nov 12, 2:44 am)
Re: [PATCH] sysctl: Check length at deprecated_sysctl_warning., Eric W. Biederman, (Tue Nov 13, 6:24 am)