Skip to contentSkip to conversation

net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()

PATCH Applied Clément Léger 3 participants 3 messages Jan 9, 2023 – Jan 11, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()

If ptp was not enabled due to missing IRQ for instance, lan966x_ptp_deinit() will dereference NULL pointers.

Fixes d096459494a8 ("net: lan966x: Add support for ptp clocks")

---
Changes in v2:
- Added Reviewed-by: Horatiu Vultur
- Added net in patch subject to target net tree

 drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c +3 -0
index f9ebfaafbebc..a8348437dd87 100644
@@ -1073,6 +1073,9 @@ void lan966x_ptp_deinit(struct lan966x *lan966x)
 	struct lan966x_port *port;
 	int i;
 
+	if (!lan966x->ptp)
+		return;
+
 	for (i = 0; i < lan966x->num_phys_ports; i++) {
 		port = lan966x->ports[i];
 		if (!port)
Signature · 1 line
2.38.1
#2 lore raw
In reply to Clément Léger
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Mon, 9 Jan 2023 16:32:23 +0100 you wrote:

If ptp was not enabled due to missing IRQ for instance, lan966x_ptp_deinit() will dereference NULL pointers.

Fixes d096459494a8 ("net: lan966x: Add support for ptp clocks")

[...]

Here is the summary with links:
- [net,v2] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit()

    https://git.kernel.org/netdev/net/c/b0e380b5d427

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html