Commit 208491d8 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

skge: race with workq and RTNL

If a workqueue function that needs RTNL is running when skge_down
is called then a deadlock is possible. Fix by only clearing the timer,
and handling the flush_scheduled_work on removal. This work queue is only
ever used for the old fiber based boards.
Signed-off-by: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 8b5b4671
...@@ -1419,7 +1419,8 @@ static void xm_link_timer(struct work_struct *work) ...@@ -1419,7 +1419,8 @@ static void xm_link_timer(struct work_struct *work)
mutex_unlock(&hw->phy_mutex); mutex_unlock(&hw->phy_mutex);
nochange: nochange:
schedule_delayed_work(&skge->link_thread, LINK_HZ); if (netif_running(dev))
schedule_delayed_work(&skge->link_thread, LINK_HZ);
} }
static void genesis_mac_init(struct skge_hw *hw, int port) static void genesis_mac_init(struct skge_hw *hw, int port)
...@@ -2530,7 +2531,7 @@ static int skge_down(struct net_device *dev) ...@@ -2530,7 +2531,7 @@ static int skge_down(struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
cancel_rearming_delayed_work(&skge->link_thread); cancel_delayed_work(&skge->link_thread);
skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
if (hw->chip_id == CHIP_ID_GENESIS) if (hw->chip_id == CHIP_ID_GENESIS)
...@@ -3690,6 +3691,8 @@ static void __devexit skge_remove(struct pci_dev *pdev) ...@@ -3690,6 +3691,8 @@ static void __devexit skge_remove(struct pci_dev *pdev)
if (!hw) if (!hw)
return; return;
flush_scheduled_work();
if ((dev1 = hw->dev[1])) if ((dev1 = hw->dev[1]))
unregister_netdev(dev1); unregister_netdev(dev1);
dev0 = hw->dev[0]; dev0 = hw->dev[0];
...@@ -3704,8 +3707,6 @@ static void __devexit skge_remove(struct pci_dev *pdev) ...@@ -3704,8 +3707,6 @@ static void __devexit skge_remove(struct pci_dev *pdev)
skge_write16(hw, B0_LED, LED_STAT_OFF); skge_write16(hw, B0_LED, LED_STAT_OFF);
skge_write8(hw, B0_CTST, CS_RST_SET); skge_write8(hw, B0_CTST, CS_RST_SET);
flush_scheduled_work();
free_irq(pdev->irq, hw); free_irq(pdev->irq, hw);
pci_release_regions(pdev); pci_release_regions(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
......
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