From: Eddie James <eajames@linux.ibm.com>
To: Haotian Zhang <vulab@iscas.ac.cn>,
Ninad Palsule <ninad@linux.ibm.com>,
gregkh@linuxfoundation.org
Cc: linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fsi: master-hub: Fix of_node leak in probe error path
Date: Mon, 3 Nov 2025 12:12:23 -0600 [thread overview]
Message-ID: <2c522376-2a3b-44bf-b936-f0aeb70a376d@linux.ibm.com> (raw)
In-Reply-To: <20251030095534.770-1-vulab@iscas.ac.cn>
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);
prev parent reply other threads:[~2025-11-03 18:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 9:55 Haotian Zhang
2025-11-03 18:12 ` Eddie James [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=2c522376-2a3b-44bf-b936-f0aeb70a376d@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ninad@linux.ibm.com \
--cc=vulab@iscas.ac.cn \
/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®