]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.29.5/net-fix-length-computation-in-rt_check_expire.patch
Linux 2.6.29.5
[thirdparty/kernel/stable-queue.git] / releases / 2.6.29.5 / net-fix-length-computation-in-rt_check_expire.patch
1 From a99a7b580bcb2d04a5d971f73fef790945ad458f Mon Sep 17 00:00:00 2001
2 yyFrom: Eric Dumazet <dada1@cosmosbay.com>
3 Date: Tue, 19 May 2009 18:54:22 +0000
4 Subject: net: fix length computation in rt_check_expire()
5
6 From: Eric Dumazet <dada1@cosmosbay.com>
7
8 [ Upstream commit cf8da764fc6959b7efb482f375dfef9830e98205 ]
9
10 rt_check_expire() computes average and standard deviation of chain lengths,
11 but not correclty reset length to 0 at beginning of each chain.
12 This probably gives overflows for sum2 (and sum) on loaded machines instead
13 of meaningful results.
14
15 Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
16 Acked-by: Neil Horman <nhorman@tuxdriver.com>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
19
20 ---
21 net/ipv4/route.c | 5 +++--
22 1 file changed, 3 insertions(+), 2 deletions(-)
23
24 --- a/net/ipv4/route.c
25 +++ b/net/ipv4/route.c
26 @@ -785,7 +785,7 @@ static void rt_check_expire(void)
27 static unsigned int rover;
28 unsigned int i = rover, goal;
29 struct rtable *rth, **rthp;
30 - unsigned long length = 0, samples = 0;
31 + unsigned long samples = 0;
32 unsigned long sum = 0, sum2 = 0;
33 u64 mult;
34
35 @@ -795,9 +795,9 @@ static void rt_check_expire(void)
36 goal = (unsigned int)mult;
37 if (goal > rt_hash_mask)
38 goal = rt_hash_mask + 1;
39 - length = 0;
40 for (; goal > 0; goal--) {
41 unsigned long tmo = ip_rt_gc_timeout;
42 + unsigned long length;
43
44 i = (i + 1) & rt_hash_mask;
45 rthp = &rt_hash_table[i].chain;
46 @@ -809,6 +809,7 @@ static void rt_check_expire(void)
47
48 if (*rthp == NULL)
49 continue;
50 + length = 0;
51 spin_lock_bh(rt_hash_lock_addr(i));
52 while ((rth = *rthp) != NULL) {
53 if (rt_is_expired(rth)) {