[PATCH net] can: at91_can: Fix memory leak in at91_can_probe()
Marc Kleine-Budde
mkl at pengutronix.de
Fri Jan 23 06:31:32 PST 2026
On 22.01.2026 11:41:28, Zilin Guan wrote:
> In at91_can_probe(), the dev structure is allocated via alloc_candev().
> However, if the subsequent call to devm_phy_optional_get() fails, the
> code jumps directly to exit_iounmap, missing the call to free_candev().
> This results in a memory leak of the allocated net_device structure.
>
> Fix this by jumping to the exit_free label instead, which ensures that
> free_candev() is called to properly release the memory.
>
> Compile tested only. Issue found using a prototype static analysis tool
> and code review.
>
> Fixes: 3ecc09856afb ("can: at91_can: add CAN transceiver support")
> Signed-off-by: Zilin Guan <zilin at seu.edu.cn>
Applied to linux-can.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260123/aa853ca9/attachment-0001.sig>
More information about the linux-arm-kernel
mailing list