From: Felix Gu <ustc.gu@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] PCI/pwrctrl: Fix device node leak in pci_pwrctrl_is_required()
Date: Mon, 23 Mar 2026 19:05:22 +0800 [thread overview]
Message-ID: <20260323-pwctrl-v1-1-f5c03a2df7fb@gmail.com> (raw)
The for_each_endpoint_of_node() macro requires calling of_node_put() on
the endpoint node when breaking out of the loop early.
Add of_node_put(endpoint) before the early return to properly release
the reference.
Fixes: cf3287fb2c1f ("PCI/pwrctrl: Ensure that remote endpoint node parent has supply requirement")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/pci/pwrctrl/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c
index 7754baed67f2..97cff5b8ca88 100644
--- a/drivers/pci/pwrctrl/core.c
+++ b/drivers/pci/pwrctrl/core.c
@@ -299,8 +299,10 @@ static bool pci_pwrctrl_is_required(struct device_node *np)
struct device_node *remote __free(device_node) =
of_graph_get_remote_port_parent(endpoint);
if (remote) {
- if (of_pci_supply_present(remote))
+ if (of_pci_supply_present(remote)) {
+ of_node_put(endpoint);
return true;
+ }
}
}
}
---
base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
change-id: 20260323-pwctrl-fe840d733443
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
next reply other threads:[~2026-03-23 11:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 11:05 Felix Gu [this message]
2026-03-23 12:07 ` [PATCH] PCI/pwrctrl: Fix device node leak in pci_pwrctrl_is_required() Manivannan Sadhasivam
2026-03-23 13:00 ` Bartosz Golaszewski
2026-03-23 20:57 ` Bjorn Helgaas
2026-03-24 10:05 ` Felix Gu
2026-03-24 15:49 ` Bjorn Helgaas
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=20260323-pwctrl-v1-1-f5c03a2df7fb@gmail.com \
--to=ustc.gu@gmail.com \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=bhelgaas@google.com \
--cc=brgl@kernel.org \
--cc=krishna.chundru@oss.qualcomm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.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