Commit 8016dc5e authored by Zilin Guan's avatar Zilin Guan Committed by Jakub Kicinski
Browse files

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: 577f0d1b ("octeon_ep: add separate mailbox command and response queues")
Signed-off-by: default avatarZilin Guan <zilin@seu.edu.cn>
Reviewed-by: default avatarVadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20260121130551.3717090-1-zilin@seu.edu.cn


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 6de4436b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1338,7 +1338,7 @@ int octep_device_setup(struct octep_device *oct)

	ret = octep_ctrl_net_init(oct);
	if (ret)
		return ret;
		goto unsupported_dev;

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