Re: [PATCH net v3] net: sfp: fix memory leak in sfp_probe()

From: Russell King (Oracle)
Date: Wed Jun 29 2022 - 05:44:11 EST


On Wed, Jun 29, 2022 at 03:55:50PM +0800, Jianglei Nie wrote:
> sfp_probe() allocates a memory chunk from sfp with sfp_alloc(). When
> devm_add_action() fails, sfp is not freed, which leads to a memory leak.
>
> We should use devm_add_action_or_reset() instead of devm_add_action().
>
> Signed-off-by: Jianglei Nie <niejianglei2021@xxxxxxx>

Thanks!

Reviewed-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!