ethernet: atheros: fix a memleak in atl1e_setup_ring_resources
authorZhipeng Lu <alexious@zju.edu.cn>
Thu, 14 Dec 2023 13:04:04 +0000 (21:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jan 2024 12:42:31 +0000 (12:42 +0000)
commit73e159a240d78687610054d988e428a46eba94eb
tree2bbd89573c477333bf472971cb299a951f764720
parent2839a639db5e2204ded242d6d56a66d35250e24b
ethernet: atheros: fix a memleak in atl1e_setup_ring_resources

[ Upstream commit 309fdb1c33fe726d92d0030481346f24e1b01f07 ]

In the error handling of 'offset > adapter->ring_size', the
tx_ring->tx_buffer allocated by kzalloc should be freed,
instead of 'goto failed' instantly.

Fixes: a6a5325239c2 ("atl1e: Atheros L1E Gigabit Ethernet driver")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Reviewed-by: Suman Ghosh <sumang@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/atheros/atl1e/atl1e_main.c