Skip to content

Commit b43c142

Browse files
pfedindavem330
authored andcommitted
net: smsc911x: Fix crash if loopback test fails
On certain hardware in certain situations loopback test fails and the driver gets removed. During mdiobus_unregister() instance of PHY driver gets disposed. But by this time it has already been started using phy_connect_direct(). PHY driver uses DELAYED_WORK in order to maintain its state. Attempting to dispose the driver without calling phy_disconnect() causes deallocation of DELAYED_WORK being active. This shortly causes a bad crash in timer code. The problem can be discovered by enabling CONFIG_DEBUG_OBJECTS_TIMERS and CONFIG_DEBUG_OBJECTS_FREE Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5cbb28a commit b43c142

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/smsc/smsc911x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ static int smsc911x_mii_probe(struct net_device *dev)
10521052
#ifdef USE_PHY_WORK_AROUND
10531053
if (smsc911x_phy_loopbacktest(dev) < 0) {
10541054
SMSC_WARN(pdata, hw, "Failed Loop Back Test");
1055+
phy_disconnect(phydev);
10551056
return -ENODEV;
10561057
}
10571058
SMSC_TRACE(pdata, hw, "Passed Loop Back Test");

0 commit comments

Comments
 (0)