[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <01a908e7-d2bd-44c0-8705-b480b91412c2@gmail.com>
Date: Tue, 6 Aug 2024 09:37:44 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Joe Hattori <joe@...is.s.u-tokyo.ac.jp>, andrew@...n.ch,
olteanv@...il.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2] net: dsa: bcm_sf2: Fix a possible memory leak in
bcm_sf2_mdio_register()
On 8/5/24 18:13, Joe Hattori wrote:
> bcm_sf2_mdio_register() calls of_phy_find_device() and then
> phy_device_remove() in a loop to remove existing PHY devices.
> of_phy_find_device() eventually calls bus_find_device(), which calls
> get_device() on the returned struct device * to increment the refcount.
> The current implementation does not decrement the refcount, which causes
> memory leak.
>
> This commit adds the missing phy_device_free() call to decrement the
> refcount via put_device() to balance the refcount.
>
> Fixes: 771089c2a485 ("net: dsa: bcm_sf2: Ensure that MDIO diversion is used")
> Signed-off-by: Joe Hattori <joe@...is.s.u-tokyo.ac.jp>
Tested-by: Florian Fainelli <florian.fainelli@...adcom.com>
Reviewed-by: Florian Fainelli <florian.fainelli@...adcom.com>
--
Florian
Powered by blists - more mailing lists