From: Stephen Hemminger <shemminger@osdl.org>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
davem@davemloft.net, chas@cmf.nrl.navy.mil,
linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org
Subject: [PATCH] atm: clip timer race
Date: Wed, 12 Apr 2006 15:42:14 -0700 [thread overview]
Message-ID: <20060412154214.1dd4117d@localhost.localdomain> (raw)
In-Reply-To: <20060412145254.4dd21be6@localhost.localdomain>
By inspection, the clip idle timer code is racy on SMP.
Here is a safe version of timer management.
Untested, I don't have ATM hardware.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- clip.orig/net/atm/clip.c 2006-04-12 14:24:10.000000000 -0700
+++ clip/net/atm/clip.c 2006-04-12 14:40:01.000000000 -0700
@@ -54,8 +54,6 @@
static struct atm_vcc *atmarpd;
static struct neigh_table clip_tbl;
static struct timer_list idle_timer;
-static int start_timer = 1;
-
static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
{
@@ -725,13 +723,8 @@
return -EADDRINUSE;
}
- if (start_timer) {
- start_timer = 0;
- init_timer(&idle_timer);
- idle_timer.expires = jiffies+CLIP_CHECK_INTERVAL*HZ;
- idle_timer.function = idle_timer_check;
- add_timer(&idle_timer);
- }
+ mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ);
+
atmarpd = vcc;
set_bit(ATM_VF_META,&vcc->flags);
set_bit(ATM_VF_READY,&vcc->flags);
@@ -1002,6 +995,8 @@
register_netdevice_notifier(&clip_dev_notifier);
register_inetaddr_notifier(&clip_inet_notifier);
+ setup_timer(&idle_timer, idle_timer_check, 0);
+
#ifdef CONFIG_PROC_FS
{
struct proc_dir_entry *p;
@@ -1029,8 +1024,7 @@
/* First, stop the idle timer, so it stops banging
* on the table.
*/
- if (start_timer == 0)
- del_timer(&idle_timer);
+ del_timer_sync(&idle_timer);
/* Next, purge the table, so that the device
* unregister loop below does not hang due to
next prev parent reply other threads:[~2006-04-12 22:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-12 17:55 [PATCH] atm: clip causes unregister hang Stephen Hemminger
2006-04-12 18:08 ` Herbert Xu
2006-04-12 19:45 ` Stephen Hemminger
2006-04-12 20:00 ` Herbert Xu
2006-04-12 20:15 ` Stephen Hemminger
2006-04-12 20:25 ` Herbert Xu
2006-04-12 21:52 ` Stephen Hemminger
2006-04-12 22:42 ` Stephen Hemminger [this message]
2006-04-13 12:45 ` [PATCH] atm: clip timer race Herbert Xu
2006-04-13 17:26 ` Stephen Hemminger
2006-04-13 17:31 ` Herbert Xu
2006-04-13 21:08 ` Roland Dreier
2006-04-13 22:11 ` Herbert Xu
2006-04-14 22:56 ` David S. Miller
2006-04-13 12:28 ` [PATCH] atm: clip causes unregister hang Herbert Xu
2006-04-14 22:07 ` David S. Miller
2006-04-13 22:22 ` [PATCH 1/4] clip: run through Lindent Stephen Hemminger
2006-04-13 22:24 ` [PATCH 4/4] clip: add module info Stephen Hemminger
2006-04-13 22:45 ` [stable] [PATCH 1/4] clip: run through Lindent Greg KH
2006-04-14 9:01 ` David S. Miller
2006-04-14 22:58 ` David S. Miller
2006-04-14 22:59 ` David S. Miller
[not found] ` <20060413151945.0f181d04@localhost.localdomain>
2006-04-13 22:23 ` [PATCH 3/4] clip: notifier related cleanups Stephen Hemminger
2006-04-13 22:23 ` [PATCH 2/4] clip: get rid of PROC_FS ifdef Stephen Hemminger
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=20060412154214.1dd4117d@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=chas@cmf.nrl.navy.mil \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-atm-general@lists.sourceforge.net \
--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).