linux/drivers/net/ethernet/sun
Ruoyu Wang 36dea2f639 net: sungem: fix probe error cleanup
gem_init_one() calls gem_remove_one() when register_netdev() fails.
gem_remove_one() unregisters and frees resources owned by the net_device,
including the DMA block, MMIO mapping, PCI regions, and the net_device
itself. gem_init_one() then falls through to its own cleanup labels and
frees the same resources again.

Keep the register_netdev() error path in gem_init_one(): clear drvdata so
PM/remove paths do not see a half-registered device, remove the NAPI
instance added during probe, and let the existing cleanup labels release
the resources once.

The issue was found by a local static-analysis checker for probe error
paths. The reported path was manually inspected before sending this fix.

Compile-tested with CONFIG_SUNGEM=y. Runtime testing was not performed
because no sungem hardware is available.

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260623025759.3468566-1-ruoyuw560@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-06-24 19:26:35 -07:00
..
cassini.c net/sun: Fix multiple typos in comments 2026-06-03 19:19:59 -07:00
cassini.h net/sun: Fix multiple typos in comments 2026-06-03 19:19:59 -07:00
Kconfig net: sun: SUNVNET_COMMON should depend on INET 2021-09-28 13:20:21 +01:00
ldmvsw.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Makefile
niu.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
niu.h net: Fix typos 2025-07-25 10:29:07 -07:00
sunbmac.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
sunbmac.h net/sun: Fix multiple typos in comments 2026-06-03 19:19:59 -07:00
sungem.c net: sungem: fix probe error cleanup 2026-06-24 19:26:35 -07:00
sungem.h net/sun: Fix multiple typos in comments 2026-06-03 19:19:59 -07:00
sunhme.c net/sun: Fix multiple typos in comments 2026-06-03 19:19:59 -07:00
sunhme.h net: sunhme: Remove residual polling code 2023-03-27 08:41:56 +01:00
sunqe.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sunqe.h net: Fix typos 2025-07-25 10:29:07 -07:00
sunvnet_common.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
sunvnet_common.h
sunvnet.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00