* [PATCH net] net: micrel: Fix receiving the timestamp in the frame for lan8841
@ 2024-05-13 19:21 Horatiu Vultur
2024-05-13 19:50 ` Simon Horman
2024-05-14 12:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Horatiu Vultur @ 2024-05-13 19:21 UTC (permalink / raw)
To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
richardcochran
Cc: netdev, linux-kernel, Horatiu Vultur
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>
---
drivers/net/phy/micrel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index ddb50a0e2bc82..87780465cd0d5 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -4676,7 +4676,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);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: micrel: Fix receiving the timestamp in the frame for lan8841
2024-05-13 19:21 [PATCH net] net: micrel: Fix receiving the timestamp in the frame for lan8841 Horatiu Vultur
@ 2024-05-13 19:50 ` Simon Horman
2024-05-14 12:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-05-13 19:50 UTC (permalink / raw)
To: Horatiu Vultur
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
richardcochran, netdev, linux-kernel
On Mon, May 13, 2024 at 09:21:57PM +0200, Horatiu Vultur wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: micrel: Fix receiving the timestamp in the frame for lan8841
2024-05-13 19:21 [PATCH net] net: micrel: Fix receiving the timestamp in the frame for lan8841 Horatiu Vultur
2024-05-13 19:50 ` Simon Horman
@ 2024-05-14 12:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-14 12:40 UTC (permalink / raw)
To: Horatiu Vultur
Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
richardcochran, netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Mon, 13 May 2024 21:21:57 +0200 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net] net: micrel: Fix receiving the timestamp in the frame for lan8841
https://git.kernel.org/netdev/net/c/aea27a92a41d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-14 12:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-13 19:21 [PATCH net] net: micrel: Fix receiving the timestamp in the frame for lan8841 Horatiu Vultur
2024-05-13 19:50 ` Simon Horman
2024-05-14 12:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).