All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Manush Prajwal <manushprajwal555@gmail.com>
Cc: arnd@arndb.de, fancer.lancer@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] misc: eeprom: idt_89hpesx: fix fwnode leak in idt_get_fw_data()
Date: Thu, 1 Oct 2026 14:03:29 +0200	[thread overview]
Message-ID: <2026100150-plasma-pointing-052b@gregkh> (raw)
In-Reply-To: <6a8b286b.c86fb4cb.27e0b8.ee64@mx.google.com>

On Sun, Aug 23, 2026 at 10:35:46PM +0530, Manush Prajwal wrote:
> device_for_each_child_node() takes a reference on each fwnode it
> returns, which the loop body must release before it stops iterating.
> When idt_ee_match_id() finds a matching EEPROM child, the loop breaks
> out immediately without calling fwnode_handle_put() on that fwnode,
> leaking the reference.
> 
> Rework the loop around device_for_each_child_node_scoped() instead of
> adding a manual fwnode_handle_put(), so the reference is released
> automatically on every exit path (the early break as well as normal
> loop completion), per Markus Elfring's review of v1.
> 
> Signed-off-by: Manush Prajwal <manushprajwal555@gmail.com>
> ---
> v2: Use device_for_each_child_node_scoped() instead of a manual
>     fwnode_handle_put() before the break, and use my full name in
>     Signed-off-by, per Markus Elfring's review.
> 
>  drivers/misc/eeprom/idt_89hpesx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89hpesx.c
> index e056d2dea..a1b2c3d4e 100644
> --- a/drivers/misc/eeprom/idt_89hpesx.c
> +++ b/drivers/misc/eeprom/idt_89hpesx.c
> @@ -1080,7 +1080,7 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)
>  	struct device *dev = &pdev->client->dev;
>  	struct fwnode_handle *fwnode;
> 
> -	device_for_each_child_node(dev, fwnode) {
> +	device_for_each_child_node_scoped(dev, fwnode) {
>  		ee_id = idt_ee_match_id(fwnode);
>  		if (ee_id)
>  			break;
> --
> 2.46.2.windows.1
> 

Breaks the build, please be more careful.

      reply	other threads:[~2026-10-01 12:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 17:05 [PATCH v2] misc: eeprom: idt_89hpesx: fix fwnode leak in idt_get_fw_data() Manush Prajwal
2026-10-01 12:03 ` Greg KH [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=2026100150-plasma-pointing-052b@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=fancer.lancer@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manushprajwal555@gmail.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.