linux/drivers/net/wireless/microchip/wilc1000
Shitalkumar Gandhi dd7b6a8671 wifi: wilc1000: fix dma_buffer leak on bus acquire failure
wilc_wlan_firmware_download() allocates dma_buffer with kmalloc() at
the top of the function and uses a 'fail:' label to free it via
kfree(dma_buffer) on error.

All later error paths correctly use 'goto fail' to route through this
cleanup. However, the early failure path after the first acquire_bus()
call uses a bare 'return ret;', which leaks dma_buffer whenever the bus
acquire fails.

Replace the early return with goto fail so the existing cleanup path
runs.

Found via a custom Coccinelle semantic patch hunting for kmalloc'd
locals leaked on early-return error paths in driver firmware-download
code.

Fixes: 1241c5650f ("wifi: wilc1000: Fill in missing error handling")
Signed-off-by: Shitalkumar Gandhi <shitalkumar.gandhi@cambiumnetworks.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260511042732.998311-1-shitalkumar.gandhi@cambiumnetworks.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-05-20 11:19:55 +02:00
..
cfg80211.c wifi: cfg80211: support key installation on non-netdev wdevs 2026-03-02 11:28:33 +01:00
cfg80211.h wifi: wilc1000: Register wiphy after reading out chipid 2024-10-17 19:47:42 +03:00
fw.h wifi: wilc1000: add function to read mac address from eFuse 2024-05-17 11:01:51 +03:00
hif.c wifi: wilc1000: use kzalloc_flex 2026-04-07 15:38:05 +02:00
hif.h wifi: wilc1000: set wilc_set_mac_address parameter as const 2024-05-17 11:01:51 +03:00
Kconfig
Makefile
mon.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
netdev.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
netdev.h wifi: wilc1000: remove suspend/resume from cfg80211 part 2024-06-18 13:23:16 +03:00
sdio.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
spi.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
wlan_cfg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
wlan_cfg.h wifi: wilc1000: avoid buffer overflow in WID string configuration 2025-09-03 09:39:32 +02:00
wlan_if.h wifi: wilc1000: Increase ASSOC response buffer 2023-05-11 15:53:44 +03:00
wlan.c wifi: wilc1000: fix dma_buffer leak on bus acquire failure 2026-05-20 11:19:55 +02:00
wlan.h wifi: wilc1000: Add WILC3000 support 2024-10-17 19:47:42 +03:00