Commit 2d907392 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[ATM]: Clip timer race.

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: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f3a0592b
...@@ -54,8 +54,6 @@ static struct net_device *clip_devs; ...@@ -54,8 +54,6 @@ static struct net_device *clip_devs;
static struct atm_vcc *atmarpd; static struct atm_vcc *atmarpd;
static struct neigh_table clip_tbl; static struct neigh_table clip_tbl;
static struct timer_list idle_timer; 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) static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
{ {
...@@ -725,13 +723,8 @@ static int atm_init_atmarp(struct atm_vcc *vcc) ...@@ -725,13 +723,8 @@ static int atm_init_atmarp(struct atm_vcc *vcc)
return -EADDRINUSE; return -EADDRINUSE;
} }
if (start_timer) { mod_timer(&idle_timer, jiffies+CLIP_CHECK_INTERVAL*HZ);
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);
}
atmarpd = vcc; atmarpd = vcc;
set_bit(ATM_VF_META,&vcc->flags); set_bit(ATM_VF_META,&vcc->flags);
set_bit(ATM_VF_READY,&vcc->flags); set_bit(ATM_VF_READY,&vcc->flags);
...@@ -1002,6 +995,8 @@ static int __init atm_clip_init(void) ...@@ -1002,6 +995,8 @@ static int __init atm_clip_init(void)
register_netdevice_notifier(&clip_dev_notifier); register_netdevice_notifier(&clip_dev_notifier);
register_inetaddr_notifier(&clip_inet_notifier); register_inetaddr_notifier(&clip_inet_notifier);
setup_timer(&idle_timer, idle_timer_check, 0);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
{ {
struct proc_dir_entry *p; struct proc_dir_entry *p;
...@@ -1029,8 +1024,7 @@ static void __exit atm_clip_exit(void) ...@@ -1029,8 +1024,7 @@ static void __exit atm_clip_exit(void)
/* First, stop the idle timer, so it stops banging /* First, stop the idle timer, so it stops banging
* on the table. * on the table.
*/ */
if (start_timer == 0) del_timer_sync(&idle_timer);
del_timer(&idle_timer);
/* Next, purge the table, so that the device /* Next, purge the table, so that the device
* unregister loop below does not hang due to * unregister loop below does not hang due to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment