Re: [PATCH net] net: phy: phy_device: free the phy_device on the phy_device_create error path

From: Russell King (Oracle)
Date: Fri Feb 23 2024 - 11:21:09 EST


On Fri, Feb 23, 2024 at 05:06:07PM +0100, Maxime Chevallier wrote:
> On Fri, 23 Feb 2024 17:01:54 +0100
> Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx> wrote:
>
> > When error'ing out from phy_device_create(), the previously kzalloc'd "dev"
> > pointer gets overwritten with an error pointer, without freeing it
> > beforehand, thus leaking the allocated phy_device. Add the missing kfree
> > back.
>
> Disregard , I immediatly realised that this was freed in
> phy_device_release in our case. Sorry about the noise.

Sorry your emails came in in reverse order.

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