Skip to content

Commit

Permalink
[NET]: Fix gen_estimator timer removal race
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kaber authored and David S. Miller committed Jul 11, 2007
1 parent 1498b3f commit 6b25d30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/core/gen_estimator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 6b25d30

Please sign in to comment.