From 933b5fc092f67cd4f7bdde31da20b2f211a071b8 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Wed, 30 Jun 2021 21:02:23 +0800 Subject: [PATCH] net: phy: ensure phylib state machine is stopped after calling phy_stop mainline inclusion from mainline-v5.1-rc1 commit cbfd12b3e8c3542e8142aa041714ed614d3f67b0 category: bugfix bugzilla: NA CVE: NA ------------------------------------------------------ The call to the phylib state machine in phy_stop() just ensures that the state machine isn't re-triggered, but a state machine call may be scheduled already. So lets's call phy_stop_machine(). This also allows to get rid of the call to phy_stop_machine() in phy_disconnect(). Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Reviewed-by: Weiwei Deng Reviewed-by: Zhaohui Zhong Reviewed-by: Yonglong Liu Signed-off-by: You Shengzui Reviewed-by: YueHaibing Signed-off-by: Yang Yingliang --- drivers/net/phy/phy.c | 1 + drivers/net/phy/phy_device.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 6019e0aba234..51e40a91db52 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -862,6 +862,7 @@ void phy_stop(struct phy_device *phydev) mutex_unlock(&phydev->lock); phy_state_machine(&phydev->state_queue.work); + phy_stop_machine(phydev); /* Cannot call flush_scheduled_work() here as desired because * of rtnl_lock(), but PHY_HALTED shall guarantee phy_change() diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index a64a6240920d..1117355313bc 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -825,8 +825,6 @@ void phy_disconnect(struct phy_device *phydev) if (phydev->irq > 0) phy_stop_interrupts(phydev); - phy_stop_machine(phydev); - phydev->adjust_link = NULL; phy_detach(phydev); -- GitLab