mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/2] misc: eeprom: idt_89hpesx: fix fwnode leak in idt_get_fw_data()
@ 2026-08-23 11:12 manushprajwal
  0 siblings, 0 replies; only message in thread
From: manushprajwal @ 2026-08-23 11:12 UTC (permalink / raw)
  To: arnd, gregkh; +Cc: fancer.lancer, linux-kernel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-23 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-23 11:12 [PATCH 2/2] misc: eeprom: idt_89hpesx: fix fwnode leak in idt_get_fw_data() manushprajwal

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®