Skip to content

Commit 8016dc5

Browse files
GoodLuck612kuba-moo
authored andcommitted
octeon_ep: Fix memory leak in octep_device_setup()
In octep_device_setup(), if octep_ctrl_net_init() fails, the function returns directly without unmapping the mapped resources and freeing the allocated configuration memory. Fix this by jumping to the unsupported_dev label, which performs the necessary cleanup. This aligns with the error handling logic of other paths in this function. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: 577f0d1 ("octeon_ep: add separate mailbox command and response queues") Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Link: https://patch.msgid.link/20260121130551.3717090-1-zilin@seu.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 6de4436 commit 8016dc5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/marvell/octeon_ep/octep_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ int octep_device_setup(struct octep_device *oct)
13381338

13391339
ret = octep_ctrl_net_init(oct);
13401340
if (ret)
1341-
return ret;
1341+
goto unsupported_dev;
13421342

13431343
INIT_WORK(&oct->tx_timeout_task, octep_tx_timeout_task);
13441344
INIT_WORK(&oct->ctrl_mbox_task, octep_ctrl_mbox_task);

0 commit comments

Comments
 (0)