]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[NET]: Fix gen_estimator timer removal race
authorPatrick McHardy <kaber@trash.net>
Sun, 22 Jul 2007 16:26:20 +0000 (18:26 +0200)
committerAdrian Bunk <bunk@stusta.de>
Sun, 22 Jul 2007 16:26:20 +0000 (18:26 +0200)
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>
net/core/gen_estimator.c

index b07c029e8219e3fbe6493c28e560faf0de473612..5af93535e2aa018e1c01049d61d52de857cdde5f 100644 (file)
@@ -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);
 }