From: Haotian Zhang <vulab@iscas.ac.cn>
To: Eddie James <eajames@linux.ibm.com>, Ninad Palsule <ninad@linux.ibm.com>
Cc: linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Haotian Zhang <vulab@iscas.ac.cn>
Subject: [PATCH] fsi: master-hub: Fix of_node leak in probe error path
Date: Thu, 30 Oct 2025 17:55:33 +0800 [thread overview]
Message-ID: <20251030095534.770-1-vulab@iscas.ac.cn> (raw)
If the call to fsi_master_register() fails, the function exits
without releasing the of_node reference previously acquired via
of_node_get(). This results in an of_node reference count leak.
Add a call to of_node_put() under a new label to ensure the
reference is correctly released before the function returns.
Fixes: f6a2f8eb73f0 ("fsi: Match fsi slaves and engines to available dt nodes")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
drivers/fsi/fsi-master-hub.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/fsi/fsi-master-hub.c b/drivers/fsi/fsi-master-hub.c
index 6568fed7db3c..e259ed1c17e0 100644
--- a/drivers/fsi/fsi-master-hub.c
+++ b/drivers/fsi/fsi-master-hub.c
@@ -241,7 +241,7 @@ static int hub_master_probe(struct device *dev)
rc = fsi_master_register(&hub->master);
if (rc)
- goto err_release;
+ goto err_free_node;
/* At this point, fsi_master_register performs the device_initialize(),
* and holds the sole reference on master.dev. This means the device
@@ -253,6 +253,8 @@ static int hub_master_probe(struct device *dev)
get_device(&hub->master.dev);
return 0;
+err_free_node:
+ of_node_put(hub->master.dev.of_node);
err_release:
fsi_slave_release_range(fsi_dev->slave, FSI_HUB_LINK_OFFSET,
FSI_HUB_LINK_SIZE * links);
--
2.50.1.windows.1
next reply other threads:[~2025-10-30 9:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 9:55 Haotian Zhang [this message]
2025-11-03 18:12 ` Eddie James
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=20251030095534.770-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=eajames@linux.ibm.com \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ninad@linux.ibm.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
all inboxes | Powered by JetHome®