diff options
author | Horatiu Vultur <horatiu.vultur@microchip.com> | 2024-05-13 22:21:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-05-30 10:49:29 +0300 |
commit | 3fd4282d5f25c3c97fef3ef0b89b82ef4e2bc975 (patch) | |
tree | 38de075f677317d6922af9c45b477839c7753484 /drivers/net | |
parent | 487f9030b1ef34bab123f2df2a4ccbe01ba84416 (diff) | |
download | linux-3fd4282d5f25c3c97fef3ef0b89b82ef4e2bc975.tar.xz |
net: micrel: Fix receiving the timestamp in the frame for lan8841
[ Upstream commit aea27a92a41dae14843f92c79e9e42d8f570105c ]
The blamed commit started to use the ptp workqueue to get the second
part of the timestamp. And when the port was set down, then this
workqueue is stopped. But if the config option NETWORK_PHY_TIMESTAMPING
is not enabled, then the ptp_clock is not initialized so then it would
crash when it would try to access the delayed work.
So then basically by setting up and then down the port, it would crash.
The fix consists in checking if the ptp_clock is initialized and only
then cancel the delayed work.
Fixes: cc7554954848 ("net: micrel: Change to receive timestamp in the frame for lan8841")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/phy/micrel.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 1f950c824418..827db6a6ff39 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -4635,7 +4635,8 @@ static int lan8841_suspend(struct phy_device *phydev) struct kszphy_priv *priv = phydev->priv; struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv; - ptp_cancel_worker_sync(ptp_priv->ptp_clock); + if (ptp_priv->ptp_clock) + ptp_cancel_worker_sync(ptp_priv->ptp_clock); return genphy_suspend(phydev); } |