* [PATCH] fsi: master-hub: Fix of_node leak in probe error path
@ 2025-10-30 9:55 Haotian Zhang
2025-11-03 18:12 ` Eddie James
0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2025-10-30 9:55 UTC (permalink / raw)
To: Eddie James, Ninad Palsule; +Cc: linux-fsi, linux-kernel, Haotian Zhang
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] fsi: master-hub: Fix of_node leak in probe error path
2025-10-30 9:55 [PATCH] fsi: master-hub: Fix of_node leak in probe error path Haotian Zhang
@ 2025-11-03 18:12 ` Eddie James
0 siblings, 0 replies; 2+ messages in thread
From: Eddie James @ 2025-11-03 18:12 UTC (permalink / raw)
To: Haotian Zhang, Ninad Palsule, gregkh; +Cc: linux-fsi, linux-kernel
On 10/30/25 4:55 AM, Haotian Zhang wrote:
> 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.
Reviewed-by: Eddie James <eajames@linux.ibm.com>
>
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-03 18:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-30 9:55 [PATCH] fsi: master-hub: Fix of_node leak in probe error path Haotian Zhang
2025-11-03 18:12 ` Eddie James
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®