]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sysctl: fix min/max handling in __do_proc_doulongvec_minmax()
authorEric Dumazet <eric.dumazet@gmail.com>
Thu, 7 Oct 2010 19:59:29 +0000 (12:59 -0700)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Sun, 17 Apr 2011 20:15:55 +0000 (16:15 -0400)
commit 27b3d80a7b6adcf069b5e869e4efcc3a79f88a91 upstream.

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().

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Americo Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/sysctl.c

index 8686b0f5fc12fc85d19c31d934bbe34bd55d5af2..d2cededc2bd287152757b4c781e5967fd565a54a 100644 (file)
@@ -2314,7 +2314,7 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
        vleft = table->maxlen / sizeof(unsigned long);
        left = *lenp;
        
-       for (; left && vleft--; i++, min++, max++, first=0) {
+       for (; left && vleft--; i++, first = 0) {
                if (write) {
                        while (left) {
                                char c;