[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y48qrNjmRT7iIx1Z@shell.armlinux.org.uk>
Date: Tue, 6 Dec 2022 11:42:36 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Zeng Heng <zengheng4@...wei.com>
Cc: hkallweit1@...il.com, edumazet@...gle.com, pabeni@...hat.com,
kuba@...nel.org, davem@...emloft.net, andrew@...n.ch,
f.fainelli@...il.com, liwei391@...wei.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] net: mdio: fix unbalanced fwnode reference count in
mdio_device_release()
On Sat, Dec 03, 2022 at 03:34:41PM +0800, Zeng Heng wrote:
> There is warning report about of_node refcount leak
> while probing mdio device:
>
> OF: ERROR: memory leak, expected refcount 1 instead of 2,
> of_node_get()/of_node_put() unbalanced - destroy cset entry:
> attach overlay node /spi/soc@...dio@...700c0/ethernet@4
>
> In of_mdiobus_register_device(), we increase fwnode refcount
> by fwnode_handle_get() before associating the of_node with
> mdio device, but it has never been decreased in normal path.
> Since that, in mdio_device_release(), it needs to call
> fwnode_handle_put() in addition instead of calling kfree()
> directly.
>
> After above, just calling mdio_device_free() in the error handle
> path of of_mdiobus_register_device() is enough to keep the
> refcount balanced.
>
> Fixes: a9049e0c513c ("mdio: Add support for mdio drivers.")
> Signed-off-by: Zeng Heng <zengheng4@...wei.com>
> Reviewed-by: Yang Yingliang <yangyingliang@...wei.com>
LGTM, thanks!
Reviewed-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists