From: Vinod Koul <vkoul@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org,
mani@kernel.org, mchehab+huawei@kernel.org,
neil.armstrong@linaro.org, stable@vger.kernel.org
Subject: Re: [PATCH] phy: HiSilicon: Fix device node reference leak in hi3670_pcie_get_resources_from_pcie()
Date: Thu, 12 Nov 2026 14:04:49 +0530 [thread overview]
Message-ID: <avV6KSL8Q6vVHsrO@parshuram> (raw)
In-Reply-To: <20260917134144.2153731-1-vulab@iscas.ac.cn>
On 17-09-26, 13:41, Wentao Liang wrote:
> hi3670_pcie_get_resources_from_pcie() obtains the "pcie" child node
> with of_get_child_by_name(), which takes a reference on the node, but
> never releases it: both the "Didn't find pcie device" and the "Failed
> to get APB regmap" error paths, as well as the success path, return
> without calling of_node_put().
>
> The node is only needed for the device lookup, so drop the reference
> right after bus_find_device_by_of_node().
We already have 1499f3d3407f ("phy: hisilicon: hi3670: Fix OF node and device reference leaks")
>
> Fixes: 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/phy/hisilicon/phy-hi3670-pcie.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
> index 87eac058a4bc..35e634279794 100644
> --- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
> +++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
> @@ -570,6 +570,7 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy)
> }
>
> pcie_dev = bus_find_device_by_of_node(&platform_bus_type, pcie_port);
> + of_node_put(pcie_port);
> if (!pcie_dev) {
> dev_err(dev, "Didn't find pcie device\n");
> return -ENODEV;
> --
> 2.34.1
--
~Vinod
WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Wentao Liang <vulab@iscas.ac.cn>
Cc: linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org,
mani@kernel.org, mchehab+huawei@kernel.org,
neil.armstrong@linaro.org, stable@vger.kernel.org
Subject: Re: [PATCH] phy: HiSilicon: Fix device node reference leak in hi3670_pcie_get_resources_from_pcie()
Date: Thu, 12 Nov 2026 14:04:49 +0530 [thread overview]
Message-ID: <avV6KSL8Q6vVHsrO@parshuram> (raw)
In-Reply-To: <20260917134144.2153731-1-vulab@iscas.ac.cn>
On 17-09-26, 13:41, Wentao Liang wrote:
> hi3670_pcie_get_resources_from_pcie() obtains the "pcie" child node
> with of_get_child_by_name(), which takes a reference on the node, but
> never releases it: both the "Didn't find pcie device" and the "Failed
> to get APB regmap" error paths, as well as the success path, return
> without calling of_node_put().
>
> The node is only needed for the device lookup, so drop the reference
> right after bus_find_device_by_of_node().
We already have 1499f3d3407f ("phy: hisilicon: hi3670: Fix OF node and device reference leaks")
>
> Fixes: 73075011ffff ("phy: HiSilicon: Add driver for Kirin 970 PCIe PHY")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> drivers/phy/hisilicon/phy-hi3670-pcie.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/phy/hisilicon/phy-hi3670-pcie.c b/drivers/phy/hisilicon/phy-hi3670-pcie.c
> index 87eac058a4bc..35e634279794 100644
> --- a/drivers/phy/hisilicon/phy-hi3670-pcie.c
> +++ b/drivers/phy/hisilicon/phy-hi3670-pcie.c
> @@ -570,6 +570,7 @@ static int hi3670_pcie_get_resources_from_pcie(struct hi3670_pcie_phy *phy)
> }
>
> pcie_dev = bus_find_device_by_of_node(&platform_bus_type, pcie_port);
> + of_node_put(pcie_port);
> if (!pcie_dev) {
> dev_err(dev, "Didn't find pcie device\n");
> return -ENODEV;
> --
> 2.34.1
--
~Vinod
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
next prev parent reply other threads:[~2026-11-12 8:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 13:41 [PATCH] phy: HiSilicon: Fix device node reference leak in hi3670_pcie_get_resources_from_pcie() Wentao Liang
2026-09-17 13:41 ` Wentao Liang
2026-10-12 16:09 ` Manivannan Sadhasivam
2026-10-12 16:09 ` Manivannan Sadhasivam
2026-11-12 8:34 ` Vinod Koul [this message]
2026-11-12 8:34 ` Vinod Koul
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=avV6KSL8Q6vVHsrO@parshuram \
--to=vkoul@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=mani@kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=stable@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.