diff mbox series

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

Message ID 20240513192157.3917664-1-horatiu.vultur@microchip.com (mailing list archive)
State Accepted
Commit aea27a92a41dae14843f92c79e9e42d8f570105c
Delegated to: Netdev Maintainers
Headers show
Series [net] net: micrel: Fix receiving the timestamp in the frame for lan8841 | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 925 this patch: 925
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 936 this patch: 936
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 936 this patch: 936
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-05-14--00-00 (tests: 1022)

Commit Message

Horatiu Vultur May 13, 2024, 7:21 p.m. UTC
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(-)

Comments

Simon Horman May 13, 2024, 7:50 p.m. UTC | #1
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>
patchwork-bot+netdevbpf@kernel.org May 14, 2024, 12:40 p.m. UTC | #2
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!
diff mbox series

Patch

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);
 }