Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 577f0d1b1c5f ("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>

authored by

Zilin Guan and committed by
Jakub Kicinski
8016dc5e 6de4436b

+1 -1
+1 -1
drivers/net/ethernet/marvell/octeon_ep/octep_main.c
··· 1338 1338 1339 1339 ret = octep_ctrl_net_init(oct); 1340 1340 if (ret) 1341 - return ret; 1341 + goto unsupported_dev; 1342 1342 1343 1343 INIT_WORK(&oct->tx_timeout_task, octep_tx_timeout_task); 1344 1344 INIT_WORK(&oct->ctrl_mbox_task, octep_ctrl_mbox_task);