summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-07-22 18:26:20 +0200
committerAdrian Bunk <bunk@stusta.de>2007-07-22 18:26:20 +0200
commite5e0ad360edc354c661ef2ab49d42ae964fc46f7 (patch)
tree55830ae049f3a97e09d3b529df42e57251000dbc
parentc88fee3c266ce5147abf2f4efd9bed4249e122d4 (diff)
downloadlwn-e5e0ad360edc354c661ef2ab49d42ae964fc46f7.tar.gz
lwn-e5e0ad360edc354c661ef2ab49d42ae964fc46f7.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> Signed-off-by: Adrian Bunk <bunk@stusta.de>
-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 b07c029e8219..5af93535e2aa 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);
}