Skip to contentSkip to conversation

: Fix gen_estimator timer removal race

NET Applied Patrick McHardy 3 participants 3 messages Jul 4, 2007 – Jul 10, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

This is an updated version of the gen_estimator fix that relies on all changes happening under the rtnl and just fixes the race between timer rearming and timer removal.

[NET]: Fix gen_estimator timer removal race

As noticed by Jarek Poplawski <[email protected]>, 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.

---
commit 369edff5c22c6838cb632c24a1971f1ce6823991
tree b0f47f8469ed9fc47e8fc6b597b204aac816133a
parent ba609a9d97ba231c3d94443c50579ceb5fc33867
author Patrick McHardy <[email protected]> Wed, 04 Jul 2007 17:45:26 +0200 committer Patrick McHardy <[email protected]> Wed, 04 Jul 2007 17:45:26 +0200

 net/core/gen_estimator.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
net/core/gen_estimator.c +2 -1
index 17daf4c..cc84d8d 100644
@@ -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);
 }
 
#1 lore raw
Quoted 9 lines · Patrick McHardy

This is an updated version of the gen_estimator fix that relies on all changes happening under the rtnl and just fixes the race between timer rearming and timer removal.

[NET]: Fix gen_estimator timer removal race

Quoted 7 lines

As noticed by Jarek Poplawski <[email protected]>, 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.

maintainer Applied
#2 lore raw

From: Jarek Poplawski <[email protected]>
Date: Thu, 5 Jul 2007 07:48:01 +0200

Quoted 13 lines · Patrick McHardy
Quoted 12 lines

This is an updated version of the gen_estimator fix that relies on all changes happening under the rtnl and just fixes the race between timer rearming and timer removal.

[NET]: Fix gen_estimator timer removal race

As noticed by Jarek Poplawski <[email protected]>, the timer removal in gen_kill_estimator races with the timer function rearming the timer.

Quoted 6 lines
Quoted 4 lines

Check whether the timer list is empty before rearming the timer in the timer function to fix this.

Applied, thanks guys.