netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] r8169: fix a race between PCI probe and dev_open
@ 2007-01-31 21:34 Francois Romieu
  2007-02-01  0:55 ` Linus Torvalds
  2007-02-01  2:40 ` Herbert Xu
  0 siblings, 2 replies; 6+ messages in thread
From: Francois Romieu @ 2007-01-31 21:34 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: netdev, Andrew Morton, jgarzik, Bernhard Walle

Call chain:
-> rtl8169_init_one
   -> register_netdev                  (dev_open starts to race...)
   -> rtl8169_init_phy
      -> rtl8169_set_speed
         -> tp->set_speed
         -> mod_timer(&tp->timer, ...) (if netif_running() is true)

As netif_running() is true just before dev->open() is issued and the
timer is initialized during dev->open, mod_timer() meets an uninitialized
tp->timer and oopses.

rtl8169_init_phy is only used on rtl8169_init_one so it's fine to never
ask it to activate the timer: the racing dev->open will do it anyway.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Bernhard Walle <bwalle@suse.de>
---
 drivers/net/r8169.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 577babd..3fc0611 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1448,7 +1448,7 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 
 	rtl8169_phy_reset(dev, tp);
 
-	rtl8169_set_speed(dev, autoneg, speed, duplex);
+	tp->set_speed(dev, autoneg, speed, duplex);
 
 	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
 		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-02-01 13:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-31 21:34 [PATCH] r8169: fix a race between PCI probe and dev_open Francois Romieu
2007-02-01  0:55 ` Linus Torvalds
2007-02-01  8:17   ` Francois Romieu
2007-02-01 13:04   ` Jeff Garzik
2007-02-01  2:40 ` Herbert Xu
2007-02-01  8:28   ` Francois Romieu

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).