mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: manushprajwal <manushprajwal555@gmail.com>
To: arnd@arndb.de, gregkh@linuxfoundation.org
Cc: fancer.lancer@gmail.com, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] misc: eeprom: idt_89hpesx: fix fwnode leak in idt_get_fw_data()
Date: Sun, 23 Aug 2026 16:42:59 +0530	[thread overview]
Message-ID: <20260823111259.1937-1-manushprajwal555@gmail.com> (raw)

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. Add the missing fwnode_handle_put() call
before the break.

Signed-off-by: manushprajwal <manushprajwal555@gmail.com>
---
 drivers/misc/eeprom/idt_89hpesx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89hpesx.c
index e056d2dea..f32c27855 100644
--- a/drivers/misc/eeprom/idt_89hpesx.c
+++ b/drivers/misc/eeprom/idt_89hpesx.c
@@ -1082,8 +1082,10 @@ static void idt_get_fw_data(struct idt_89hpesx_dev *pdev)
 
 	device_for_each_child_node(dev, fwnode) {
 		ee_id = idt_ee_match_id(fwnode);
-		if (ee_id)
+		if (ee_id) {
+			fwnode_handle_put(fwnode);
 			break;
+		}
 
 		dev_warn(dev, "Skip unsupported EEPROM device %pfw\n", fwnode);
 	}
-- 
2.46.2.windows.1


                 reply	other threads:[~2026-08-23 11:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260823111259.1937-1-manushprajwal555@gmail.com \
    --to=manushprajwal555@gmail.com \
    --cc=arnd@arndb.de \
    --cc=fancer.lancer@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®