Skip to content

Commit 6a23c55

Browse files
Russell King (Oracle)Paolo Abeni
authored andcommitted
net: phy: fix regression with AX88772A PHY driver
Marek reports that a deadlock occurs with the AX88772A PHY used on the ASIX USB network driver: asix 1-1.4:1.0 (unnamed net_device) (uninitialized): PHY [usb-001:003:10] driver [Asix Electronics AX88772A] (irq=POLL) Asix Electronics AX88772A usb-001:003:10: attached PHY driver(mii_bus:phy_addr=usb-001:003:10, irq=POLL) asix 1-1.4:1.0 eth0: register 'asix' at usb-12110000.usb-1.4, ASIX AX88772 USB 2.0 Ethernet, a2:99:b6:cd:11:eb asix 1-1.4:1.0 eth0: configuring for phy/internal link mode ============================================ WARNING: possible recursive locking detected 6.6.0-rc1-00239-g8da77df649c4-dirty #13949 Not tainted -------------------------------------------- kworker/3:3/71 is trying to acquire lock: c6c704cc (&dev->lock){+.+.}-{3:3}, at: phy_start_aneg+0x1c/0x38 but task is already holding lock: c6c704cc (&dev->lock){+.+.}-{3:3}, at: phy_state_machine+0x100/0x2b8 This is because we now consistently call phy_process_state_change() while holding phydev->lock, but the AX88772A PHY driver then goes on to call phy_start_aneg() which tries to grab the same lock - causing deadlock. Fix this by exporting the unlocked version, and use this in the PHY driver instead. Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Fixes: ef113a6 ("net: phy: call phy_error_precise() while holding the lock") Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/E1qiEFs-007g7b-Lq@rmk-PC.armlinux.org.uk Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 1964aac commit 6a23c55

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/net/phy/ax88796b.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void asix_ax88772a_link_change_notify(struct phy_device *phydev)
9090
*/
9191
if (phydev->state == PHY_NOLINK) {
9292
phy_init_hw(phydev);
93-
phy_start_aneg(phydev);
93+
_phy_start_aneg(phydev);
9494
}
9595
}
9696

drivers/net/phy/phy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ static int phy_check_link_status(struct phy_device *phydev)
981981
* If the PHYCONTROL Layer is operating, we change the state to
982982
* reflect the beginning of Auto-negotiation or forcing.
983983
*/
984-
static int _phy_start_aneg(struct phy_device *phydev)
984+
int _phy_start_aneg(struct phy_device *phydev)
985985
{
986986
int err;
987987

@@ -1002,6 +1002,7 @@ static int _phy_start_aneg(struct phy_device *phydev)
10021002

10031003
return err;
10041004
}
1005+
EXPORT_SYMBOL(_phy_start_aneg);
10051006

10061007
/**
10071008
* phy_start_aneg - start auto-negotiation for this PHY device

include/linux/phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,6 +1736,7 @@ void phy_detach(struct phy_device *phydev);
17361736
void phy_start(struct phy_device *phydev);
17371737
void phy_stop(struct phy_device *phydev);
17381738
int phy_config_aneg(struct phy_device *phydev);
1739+
int _phy_start_aneg(struct phy_device *phydev);
17391740
int phy_start_aneg(struct phy_device *phydev);
17401741
int phy_aneg_done(struct phy_device *phydev);
17411742
int phy_speed_down(struct phy_device *phydev, bool sync);

0 commit comments

Comments
 (0)