]> git.hungrycats.org Git - linux/commitdiff
[PATCH] gen estimator timer unload race
authorPatrick McHardy <kaber@trash.net>
Wed, 18 Jul 2007 09:48:43 +0000 (02:48 -0700)
committerWilly Tarreau <w@1wt.eu>
Sat, 25 Aug 2007 15:23:58 +0000 (17:23 +0200)
[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: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/core/gen_estimator.c

index 3cad026764f0c9b94f9615ee22da0f9b4ed16833..33d82bfa31900d5e872a3e8c1bfa66827a344e89 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);
 }