Message ID | 20230109153223.390015-1-clement.leger@bootlin.com (mailing list archive) |
---|---|
State | Accepted |
Commit | b0e380b5d4275299adf43e249f18309331b6f54f |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,v2] net: lan966x: check for ptp to be enabled in lan966x_ptp_deinit() | expand |
Mon, Jan 09, 2023 at 04:32:23PM CET, clement.leger@bootlin.com 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") >Signed-off-by: Clément Léger <clement.leger@bootlin.com> >Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Hello: This patch was applied to netdev/net.git (master) by David S. Miller <davem@davemloft.net>: 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") > Signed-off-by: Clément Léger <clement.leger@bootlin.com> > Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com> > > [...] 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!
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c index f9ebfaafbebc..a8348437dd87 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_ptp.c @@ -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)