public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tg3: netif_carrier_off runs too early; could still be queued when init fails
@ 2006-02-20 19:43 Jeff Mahoney
  2006-02-21 16:44 ` Michael Chan
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Mahoney @ 2006-02-20 19:43 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds, Linux Kernel Mailing List
  Cc: Michael Chan, Jeff Garzik

 This patch moves the netif_carrier_off() call from tg3_init_one()->
 tg3_init_link_config() to tg3_open() as is the convention for most
 other network drivers.

 I was getting a panic after a tg3 device failed to initialize due to DMA
 failure. The oops pointed to the link watch queue with spinlock debugging
 enabled. Without spinlock debugging, the Oops didn't occur.

 I suspect that the link event was getting queued but not executed until
 after the DMA test had failed and the device was freed. The link event
 was then operating on freed memory, which could contain anything. With this
 patch applied, the Oops no longer occurs. 

 I believe this to be correct, but since I'm not a network guru, perhaps
 someone who is could comment?

Signed-off-by: Jeff Mahoney <jeffm@suse.com>

diff -ruNpX dontdiff linux-2.6.16-rc4/drivers/net/tg3.c linux-2.6.16-rc4.tg3/drivers/net/tg3.c
--- linux-2.6.16-rc4/drivers/net/tg3.c	2006-02-20 13:52:40.000000000 -0500
+++ linux-2.6.16-rc4.tg3/drivers/net/tg3.c	2006-02-20 13:54:20.000000000 -0500
@@ -6443,6 +6443,8 @@ static int tg3_open(struct net_device *d
 	struct tg3 *tp = netdev_priv(dev);
 	int err;
 
+	netif_carrier_off(tp->dev);
+
 	tg3_full_lock(tp, 0);
 
 	tg3_disable_ints(tp);
@@ -10430,7 +10432,6 @@ static void __devinit tg3_init_link_conf
 	tp->link_config.speed = SPEED_INVALID;
 	tp->link_config.duplex = DUPLEX_INVALID;
 	tp->link_config.autoneg = AUTONEG_ENABLE;
-	netif_carrier_off(tp->dev);
 	tp->link_config.active_speed = SPEED_INVALID;
 	tp->link_config.active_duplex = DUPLEX_INVALID;
 	tp->link_config.phy_is_low_power = 0;
-- 
Jeff Mahoney
SuSE Labs

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

end of thread, other threads:[~2006-02-22 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-20 19:43 [PATCH] tg3: netif_carrier_off runs too early; could still be queued when init fails Jeff Mahoney
2006-02-21 16:44 ` Michael Chan
2006-02-21 21:39   ` David S. Miller
2006-02-21 22:41     ` Jeff Mahoney
2006-02-21 21:57       ` Michael Chan
2006-02-22  0:35         ` David S. Miller
2006-02-22 16:48         ` Jeff Mahoney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox