aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2007-09-29 01:42:15 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:53:55 -0400
commit6daf65310374d24d888201b7a6eba90b44008b7b (patch)
tree787e4f56bea7096d198928e0af1cd091d5e5be31 /drivers/net
parent0ac49527318bc388a881152d60f49d7951606024 (diff)
PHYLIB: fix an interrupt loop potential when halting
Ensure the PHY_HALTED state is not entered with the IRQ asserted as it could lead to an interrupt loop. There is a small window in phy_stop(), where the state of the PHY machine indicates it has been halted, but its interrupt output might still be unmasked. If an interrupt goes active right at this moment it will loop as the phy_interrupt() handler exits immediately with IRQ_NONE if the halted state is seen. It is unsafe to extend the phydev spinlock to cover phy_interrupt(). It is safe to swap the order of the actions though as all the competing places to unmask the interrupt output of the PHY, which are phy_change() and phy_timer() are already covered with the lock as is the sequence in question. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Cc: Andy Fleming <afleming@freescale.com> Cc: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/phy/phy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 5a314edc2744..9bc11773705b 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -737,8 +737,6 @@ void phy_stop(struct phy_device *phydev)
737 if (PHY_HALTED == phydev->state) 737 if (PHY_HALTED == phydev->state)
738 goto out_unlock; 738 goto out_unlock;
739 739
740 phydev->state = PHY_HALTED;
741
742 if (phydev->irq != PHY_POLL) { 740 if (phydev->irq != PHY_POLL) {
743 /* Disable PHY Interrupts */ 741 /* Disable PHY Interrupts */
744 phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED); 742 phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED);
@@ -747,6 +745,8 @@ void phy_stop(struct phy_device *phydev)
747 phy_clear_interrupt(phydev); 745 phy_clear_interrupt(phydev);
748 } 746 }
749 747
748 phydev->state = PHY_HALTED;
749
750out_unlock: 750out_unlock:
751 spin_unlock_bh(&phydev->lock); 751 spin_unlock_bh(&phydev->lock);
752 752