[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250417093834.4e1d29b6@fedora.home>
Date: Thu, 17 Apr 2025 09:38:34 +0200
From: Maxime Chevallier <maxime.chevallier@...tlin.com>
To: Qingfang Deng <dqfext@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, "Maciej S. Szmigiero"
<mail@...iej.szmigiero.name>, Nathan Sullivan <nathan.sullivan@...com>,
Josh Cartwright <josh.cartwright@...com>, Zach Brown <zach.brown@...com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Chuanhong Guo
<gch981213@...il.com>, Qingfang Deng <qingfang.deng@...lower.com.cn>, Hao
Guan <hao.guan@...lower.com.cn>
Subject: Re: [PATCH net] net: phy: leds: fix memory leak
On Thu, 17 Apr 2025 11:25:56 +0800
Qingfang Deng <dqfext@...il.com> wrote:
> From: Qingfang Deng <qingfang.deng@...lower.com.cn>
>
> A network restart test on a router led to an out-of-memory condition,
> which was traced to a memory leak in the PHY LED trigger code.
>
> The root cause is misuse of the devm API. The registration function
> (phy_led_triggers_register) is called from phy_attach_direct, not
> phy_probe, and the unregister function (phy_led_triggers_unregister)
> is called from phy_detach, not phy_remove. This means the register and
> unregister functions can be called multiple times for the same PHY
> device, but devm-allocated memory is not freed until the driver is
> unbound.
Are there historical reasons for the triggers not to be registered at
probe time ? I agree with your analysis otherwise.
Maxime
Powered by blists - more mailing lists