linux/drivers/net/ethernet/faraday
Yufan Chen c0fd0fe745 net: ftgmac100: fix ring allocation unwind on open failure
ftgmac100_alloc_rings() allocates rx_skbs, tx_skbs, rxdes, txdes, and
rx_scratch in stages. On intermediate failures it returned -ENOMEM
directly, leaking resources allocated earlier in the function.

Rework the failure path to use staged local unwind labels and free
allocated resources in reverse order before returning -ENOMEM. This
matches common netdev allocation cleanup style.

Fixes: d72e01a043 ("ftgmac100: Use a scratch buffer for failed RX allocations")
Cc: stable@vger.kernel.org
Signed-off-by: Yufan Chen <yufan.chen@linux.dev>
Link: https://patch.msgid.link/20260328163257.60836-1-yufan.chen@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-03-31 19:38:36 -07:00
..
Kconfig net: ftgmac100: select FIXED_PHY 2025-06-18 14:11:16 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ftgmac100.c net: ftgmac100: fix ring allocation unwind on open failure 2026-03-31 19:38:36 -07:00
ftgmac100.h net: ftgmac100: Enable TX interrupt to avoid TX timeout 2024-09-10 12:50:07 +02:00
ftmac100.c net: ethernet: Switch back to struct platform_driver::remove() 2024-10-04 16:39:56 -07:00
ftmac100.h net: ftmac100: fix endianness-related issues from 'sparse' 2022-09-06 10:24:05 +02:00