]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ftgmac100: fix ring allocation unwind on open failure
authorYufan Chen <yufan.chen@linux.dev>
Sat, 28 Mar 2026 16:32:57 +0000 (00:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Apr 2026 12:29:54 +0000 (14:29 +0200)
commit82f86111f0704ab2ded11a2033bc6cf0be3e09ea
treedd68256ebcd2559fd31d1b345b9fa89835f747b3
parentb69c4236255bd8de16cd876e58c6f0867d1d78b1
net: ftgmac100: fix ring allocation unwind on open failure

commit c0fd0fe745f5e8c568d898cd1513d0083e46204a upstream.

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: d72e01a0430f ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/faraday/ftgmac100.c