From: Bart Samwel When (integer) sysctl values are in either seconds or centiseconds, but represented internally as jiffies, the allowable value range is decreased. This patch adds range checks to the conversion routines. For values in seconds: maximum LONG_MAX / HZ. For values in centiseconds: maximum (LONG_MAX / HZ) * USER_HZ. (BTW, does anyone else feel that an interface in seconds should not be accepting negative values?) Signed-off-by: Bart Samwel Signed-off-by: Andrew Morton --- kernel/sysctl.c | 4 ++++ 1 files changed, 4 insertions(+) diff -puN kernel/sysctl.c~range-checking-in-do_proc_dointvec_userhz_jiffies_conv kernel/sysctl.c --- devel/kernel/sysctl.c~range-checking-in-do_proc_dointvec_userhz_jiffies_conv 2006-03-11 02:46:45.000000000 -0800 +++ devel-akpm/kernel/sysctl.c 2006-03-11 02:46:45.000000000 -0800 @@ -2064,6 +2064,8 @@ static int do_proc_dointvec_jiffies_conv int write, void *data) { if (write) { + if (*lvalp > LONG_MAX / HZ) + return 1; *valp = *negp ? -(*lvalp*HZ) : (*lvalp*HZ); } else { int val = *valp; @@ -2085,6 +2087,8 @@ static int do_proc_dointvec_userhz_jiffi int write, void *data) { if (write) { + if (USER_HZ < HZ && *lvalp > (LONG_MAX / HZ) * USER_HZ) + return 1; *valp = clock_t_to_jiffies(*negp ? -*lvalp : *lvalp); } else { int val = *valp; _