diff mbox series

net: usb: asix: replace mii_nway_restart in resume path

Message ID 20180717111709.8598-1-lynxis@fe80.eu
State Accepted
Commit 5c968f48021a9b3faa61ac2543cfab32461c0e05
Headers show
Series net: usb: asix: replace mii_nway_restart in resume path | expand

Commit Message

Alexander Couzens July 17, 2018, 11:17 a.m. UTC
mii_nway_restart is not pm aware which results in a rtnl deadlock.
Implement mii_nway_restart manual by setting BMCR_ANRESTART if
BMCR_ANENABLE is set.

To reproduce:
* plug an asix based usb network interface
* wait until the device enters PM (~5 sec)
* `ip link set eth1 up` will never return

Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>

---
 drivers/net/usb/asix_devices.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller July 18, 2018, 8:43 p.m. UTC | #1
From: Alexander Couzens <lynxis@fe80.eu>

Date: Tue, 17 Jul 2018 13:17:09 +0200

> mii_nway_restart is not pm aware which results in a rtnl deadlock.

> Implement mii_nway_restart manual by setting BMCR_ANRESTART if

> BMCR_ANENABLE is set.

> 

> To reproduce:

> * plug an asix based usb network interface

> * wait until the device enters PM (~5 sec)

> * `ip link set eth1 up` will never return

> 

> Fixes: d9fe64e51114 ("net: asix: Add in_pm parameter")

> Signed-off-by: Alexander Couzens <lynxis@fe80.eu>


Applied and queued up for -stable, thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 3d4f7959dabb..b1b3d8f7e67d 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -642,10 +642,12 @@  static void ax88772_restore_phy(struct usbnet *dev)
 				     priv->presvd_phy_advertise);
 
 		/* Restore BMCR */
+		if (priv->presvd_phy_bmcr & BMCR_ANENABLE)
+			priv->presvd_phy_bmcr |= BMCR_ANRESTART;
+
 		asix_mdio_write_nopm(dev->net, dev->mii.phy_id, MII_BMCR,
 				     priv->presvd_phy_bmcr);
 
-		mii_nway_restart(&dev->mii);
 		priv->presvd_phy_advertise = 0;
 		priv->presvd_phy_bmcr = 0;
 	}