public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Qingfang Deng <dqfext@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	Nathan Sullivan <nathan.sullivan@ni.com>,
	Josh Cartwright <josh.cartwright@ni.com>,
	Zach Brown <zach.brown@ni.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chuanhong Guo <gch981213@gmail.com>,
	Qingfang Deng <qingfang.deng@siflower.com.cn>,
	Hao Guan <hao.guan@siflower.com.cn>
Subject: Re: [PATCH net] net: phy: leds: fix memory leak
Date: Thu, 17 Apr 2025 09:38:34 +0200	[thread overview]
Message-ID: <20250417093834.4e1d29b6@fedora.home> (raw)
In-Reply-To: <20250417032557.2929427-1-dqfext@gmail.com>

On Thu, 17 Apr 2025 11:25:56 +0800
Qingfang Deng <dqfext@gmail.com> wrote:

> From: Qingfang Deng <qingfang.deng@siflower.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

  reply	other threads:[~2025-04-17  7:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17  3:25 [PATCH net] net: phy: leds: fix memory leak Qingfang Deng
2025-04-17  7:38 ` Maxime Chevallier [this message]
2025-04-17  7:59   ` Qingfang Deng
2025-04-17 13:55 ` Andrew Lunn
2025-04-23  1:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250417093834.4e1d29b6@fedora.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=gch981213@gmail.com \
    --cc=hao.guan@siflower.com.cn \
    --cc=hkallweit1@gmail.com \
    --cc=josh.cartwright@ni.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mail@maciej.szmigiero.name \
    --cc=nathan.sullivan@ni.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=qingfang.deng@siflower.com.cn \
    --cc=zach.brown@ni.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox