dpaa2-eth: do not hold rtnl_lock on phylink_create() or _destroy()
authorIoana Ciornei <ioana.ciornei@nxp.com>
Thu, 21 Nov 2019 19:15:25 +0000 (21:15 +0200)
committerDong Aisheng <aisheng.dong@nxp.com>
Mon, 14 Dec 2020 03:36:29 +0000 (11:36 +0800)
commit62cae88f4a6565f72b885298354cebd79e4ad8a5
tree58a1d46cb94d91729429ae8cc995961be155ebb6
parentb8ef4c9afb38a20194fe5d204e835f26d1a374d2
dpaa2-eth: do not hold rtnl_lock on phylink_create() or _destroy()

The rtnl_lock should not be held when calling phylink_create() or
phylink_destroy() since it leads to the deadlock listed below:

[   18.656576]  rtnl_lock+0x18/0x20
[   18.659798]  sfp_bus_add_upstream+0x28/0x90
[   18.663974]  phylink_create+0x2cc/0x828
[   18.667803]  dpaa2_mac_connect+0x14c/0x2a8
[   18.671890]  dpaa2_eth_connect_mac+0x94/0xd8

Fix this by moving the _lock() and _unlock() calls just outside of
phylink_of_phy_connect() and phylink_disconnect_phy().

Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
Reported-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c