summaryrefslogtreecommitdiffstats
path: root/net/core/gen_estimator.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-07-09 15:30:19 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-10 22:19:03 -0700
commit6b25d30bf112370a12d05c3c0fd43732985dab01 (patch)
tree9739e7085a36283e3755ba33887457e4dd25206a /net/core/gen_estimator.c
parent1498b3f1952ae539a7d5c356acf942d5f4c1aece (diff)
downloadlinux-stable-6b25d30bf112370a12d05c3c0fd43732985dab01.tar.gz
linux-stable-6b25d30bf112370a12d05c3c0fd43732985dab01.tar.bz2
linux-stable-6b25d30bf112370a12d05c3c0fd43732985dab01.zip
[NET]: Fix gen_estimator timer removal race
As noticed by Jarek Poplawski <jarkao2@o2.pl>, the timer removal in gen_kill_estimator races with the timer function rearming the timer. Check whether the timer list is empty before rearming the timer in the timer function to fix this. Signed-off-by: Patrick McHardy <kaber@trash.net> Acked-by: Jarek Poplawski <jarkao2@o2.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/gen_estimator.c')
-rw-r--r--net/core/gen_estimator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 17daf4c9f793..cc84d8d8a3c7 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -128,7 +128,8 @@ static void est_timer(unsigned long arg)
spin_unlock(e->stats_lock);
}
- mod_timer(&elist[idx].timer, jiffies + ((HZ<<idx)/4));
+ if (elist[idx].list != NULL)
+ mod_timer(&elist[idx].timer, jiffies + ((HZ<<idx)/4));
read_unlock(&est_lock);
}