All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net: dsa: bcm_sf2: Fix a possible memory leak in bcm_sf2_mdio_register()
Date: Mon, 5 Aug 2024 16:32:28 -0700	[thread overview]
Message-ID: <20240805163228.16956875@kernel.org> (raw)
In-Reply-To: <20240802085411.3549034-1-joe@pf.is.s.u-tokyo.ac.jp>

On Fri,  2 Aug 2024 17:54:11 +0900 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.

Please add a Fixes tag pointing to the commit where the problem was
introduced and make sure you CC the maintainer of the driver.
-- 
pw-bot: cr

      reply	other threads:[~2024-08-05 23:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02  8:54 [PATCH] net: dsa: bcm_sf2: Fix a possible memory leak in bcm_sf2_mdio_register() Joe Hattori
2024-08-05 23:32 ` Jakub Kicinski [this message]

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=20240805163228.16956875@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=joe@pf.is.s.u-tokyo.ac.jp \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.