Skip to contentSkip to conversation

fix SMP lockup in eepro100 with ethtool on unused interface

PATCH New Jason Lunz 1 participant 2 messages Mar 7, 2003 – Mar 17, 2003 Network drivers

lore
Share & tools
lore

Jason Lunz

author
#0 lore raw

PATCH 1/1 fix SMP lockup in eepro100 with ethtool on unused interface

When support for the GSET and SSET ethtool ioctls was added to eepro100.c in 2.4.20, the tx lock was overloaded to serialize their use. Unfortunately, this lock is only initialized in dev->open(), causing ethtool to deadlock the machine when used on an unconfigured eepro100 interface.

The fix is to initialize the spinlock at probe time. Jeff, the patch below is against 2.4.21-pre5, but I'm assuming you'll integrate it into 2.5 and push it to Linus as well as Marcelo. It applies to both trees.

Jason

drivers/net/eepro100.c +1 -1
@@ -842,6 +842,7 @@
 	sp->lstats = (struct speedo_stats *)(sp->tx_ring + TX_RING_SIZE);
 	sp->lstats_dma = TX_RING_ELEM_DMA(sp, TX_RING_SIZE);
 	init_timer(&sp->timer); /* used in ioctl() */
+	spin_lock_init(&sp->lock);
 
 	sp->mii_if.full_duplex = option >= 0 && (option & 0x10) ? 1 : 0;
 	if (card_idx >= 0) {
@@ -993,7 +994,6 @@
 	sp->dirty_tx = 0;
 	sp->last_cmd = 0;
 	sp->tx_full = 0;
-	spin_lock_init(&sp->lock);
 	sp->in_interrupt = 0;
 
 	/* .. we can safely take handler calls during init. */
author
#1 lore raw

PATCH 1/1 fix SMP deadlock (uninitialized spinlock)

When support for the ETHTOOL_GSET and ETHTOOL_SSET ethtool methods was added to eepro100.c in 2.4.20, the tx lock was overloaded to serialize their use. Unfortunately, this lock is only initialized in dev->open(), causing ethtool to deadlock the machine when used on a never-opened eepro100 interface.

The fix is to initialize the spinlock at probe time. The patch below is against 2.4.21-pre5, but also applies to 2.5.

please apply,

Jason

drivers/net/eepro100.c +1 -1
@@ -842,6 +842,7 @@
 	sp->lstats = (struct speedo_stats *)(sp->tx_ring + TX_RING_SIZE);
 	sp->lstats_dma = TX_RING_ELEM_DMA(sp, TX_RING_SIZE);
 	init_timer(&sp->timer); /* used in ioctl() */
+	spin_lock_init(&sp->lock);
 
 	sp->mii_if.full_duplex = option >= 0 && (option & 0x10) ? 1 : 0;
 	if (card_idx >= 0) {
@@ -993,7 +994,6 @@
 	sp->dirty_tx = 0;
 	sp->last_cmd = 0;
 	sp->tx_full = 0;
-	spin_lock_init(&sp->lock);
 	sp->in_interrupt = 0;
 
 	/* .. we can safely take handler calls during init. */