netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: David Miller <davem@davemloft.net>
Cc: Jarek Poplawski <jarkao2@o2.pl>,
	Linux Netdev List <netdev@vger.kernel.org>
Subject: [NET]: Fix gen_estimator timer removal race
Date: Wed, 04 Jul 2007 17:47:51 +0200	[thread overview]
Message-ID: <468BC127.1090904@trash.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

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.



[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1149 bytes --]

[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>

---
commit 369edff5c22c6838cb632c24a1971f1ce6823991
tree b0f47f8469ed9fc47e8fc6b597b204aac816133a
parent ba609a9d97ba231c3d94443c50579ceb5fc33867
author Patrick McHardy <kaber@trash.net> Wed, 04 Jul 2007 17:45:26 +0200
committer Patrick McHardy <kaber@trash.net> Wed, 04 Jul 2007 17:45:26 +0200

 net/core/gen_estimator.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 17daf4c..cc84d8d 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);
 }
 

             reply	other threads:[~2007-07-04 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 15:47 Patrick McHardy [this message]
2007-07-05  5:48 ` [NET]: Fix gen_estimator timer removal race Jarek Poplawski
2007-07-09 22:30   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468BC127.1090904@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=jarkao2@o2.pl \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).