sysctl: fix min/max handling in __do_proc_doulongvec_minmax()
authorEric Dumazet <[email protected]>
Thu, 7 Oct 2010 19:59:29 +0000 (12:59 -0700)
committerLinus Torvalds <[email protected]>
Thu, 7 Oct 2010 20:31:21 +0000 (13:31 -0700)
When proc_doulongvec_minmax() is used with an array of longs, and no
min/max check requested (.extra1 or .extra2 being NULL), we dereference a
NULL pointer for the second element of the array.

Noticed while doing some changes in network stack for the "16TB problem"

Fix is to not change min & max pointers in __do_proc_doulongvec_minmax(),
so that all elements of the vector share an unique min/max limit, like
proc_dointvec_minmax().

[[email protected]: coding-style fixes]
Signed-off-by: Eric Dumazet <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Americo Wang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/sysctl.c

index f88552c6d2275be1216187f07b1e0e1b22b93af2..3a45c224770fb82fa4bd76f9c7d4f2f989ee5aa9 100644 (file)
@@ -2485,7 +2485,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
                kbuf[left] = 0;
        }
 
-       for (; left && vleft--; i++, min++, max++, first=0) {
+       for (; left && vleft--; i++, first = 0) {
                unsigned long val;
 
                if (write) {