[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4FQfGKkNMzZQ7tA@lunn.ch>
Date: Sat, 26 Nov 2022 00:32:12 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Yang Yingliang <yangyingliang@...wei.com>
Cc: netdev@...r.kernel.org, hkallweit1@...il.com,
linux@...linux.org.uk, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, ioana.ciornei@....com,
calvin.johnson@....nxp.com, grant.likely@....com
Subject: Re: [PATCH net] net: mdiobus: fix unbalanced node reference count
On Thu, Nov 24, 2022 at 11:01:30PM +0800, Yang Yingliang wrote:
> I got the following report while doing device(mscc-miim) load test
> with CONFIG_OF_UNITTEST and CONFIG_OF_DYNAMIC enabled:
>
> 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@...7009c/ethernet-phy@0
>
> If the 'fwnode' is not an acpi node, the refcount is get in
> fwnode_mdiobus_phy_device_register(), but it has never been
> put when the device is freed in the normal path. So call
> fwnode_handle_put() in phy_device_release() to avoid leak.
>
> If it's an acpi node, it has never been get, but it's put
> in the error path, so call fwnode_handle_get() before
> phy_device_register() to keep get/put operation balanced.
>
> Fixes: bc1bee3b87ee ("net: mdiobus: Introduce fwnode_mdiobus_register_phy()")
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists