Commit 5c682f28 authored by Horatiu Vultur's avatar Horatiu Vultur Committed by Ma Wupeng
Browse files

net: micrel: Fix receiving the timestamp in the frame for lan8841

stable inclusion
from stable-v6.6.33
commit 3ddf170e4a604f5d4d9459a36993f5e92b53e8b0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAD6H2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3ddf170e4a604f5d4d9459a36993f5e92b53e8b0



--------------------------------

[ 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: cc755495 ("net: micrel: Change to receive timestamp in the frame for lan8841")
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Reviewed-by: default avatarSimon Horman <horms@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
parent d228ae50
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4612,6 +4612,7 @@ static int lan8841_suspend(struct phy_device *phydev)
	struct kszphy_priv *priv = phydev->priv;
	struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv;

	if (ptp_priv->ptp_clock)
		ptp_cancel_worker_sync(ptp_priv->ptp_clock);

	return genphy_suspend(phydev);