linux/drivers/net/ethernet/microchip/lan966x
Myeonghun Pak c4f3d6eb1f net: lan966x: avoid unregistering netdev on register failure
lan966x_probe_port() stores the newly allocated net_device in the
port before calling register_netdev(). If register_netdev() fails,
the probe error path calls lan966x_cleanup_ports(), which sees
port->dev and calls unregister_netdev() for a device that was never
registered.

Destroy the phylink instance created for this port and clear port->dev
before returning the registration error. The common cleanup path now skips
ports without port->dev before reaching the registered netdev cleanup, so
it only handles ports that reached the registered-netdev lifetime.

This also avoids treating an uninitialized FDMA netdev and the failed port
as a NULL == NULL match in the common cleanup path.

Fixes: d28d6d2e37 ("net: lan966x: add port module support")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Link: https://patch.msgid.link/20260506124331.31945-1-mhun512@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-05-08 16:30:45 -07:00
..
Kconfig
lan966x_cbs.c
lan966x_dcb.c
lan966x_ethtool.c lan966x: Fix sleeping in atomic context 2025-11-06 07:31:34 -08:00
lan966x_ets.c
lan966x_fdb.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
lan966x_fdma.c net: lan966x: fix use-after-free and leak in lan966x_fdma_reload() 2026-04-09 15:17:23 +02:00
lan966x_goto.c
lan966x_ifh.h
lan966x_lag.c
lan966x_mac.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
lan966x_main.c net: lan966x: avoid unregistering netdev on register failure 2026-05-08 16:30:45 -07:00
lan966x_main.h lan966x: Fix sleeping in atomic context 2025-11-06 07:31:34 -08:00
lan966x_mdb.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
lan966x_mirror.c
lan966x_mqprio.c
lan966x_phylink.c
lan966x_police.c
lan966x_port.c
lan966x_ptp.c net: lan966x: Fix the initialization of taprio 2025-11-25 15:45:19 +01:00
lan966x_regs.h
lan966x_switchdev.c net: lan966x: Make sure to insert the vlan tags also in host mode 2025-05-29 15:48:37 +02:00
lan966x_taprio.c
lan966x_tbf.c
lan966x_tc_flower.c
lan966x_tc_matchall.c
lan966x_tc.c
lan966x_vcap_ag_api.c
lan966x_vcap_ag_api.h
lan966x_vcap_debugfs.c
lan966x_vcap_impl.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
lan966x_vlan.c net: lan966x: Make sure to insert the vlan tags also in host mode 2025-05-29 15:48:37 +02:00
lan966x_xdp.c
Makefile