Re: [PATCH] PCI/pwrctrl: Fix device node leak in pci_pwrctrl_is_required()
From: Felix Gu
Date: Tue Mar 24 2026 - 06:11:32 EST
On Tue, Mar 24, 2026 at 4:57 AM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote:
>
> On Mon, Mar 23, 2026 at 07:05:22PM +0800, Felix Gu wrote:
> > 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@xxxxxxxxx>
>
> cf3287fb2c1f appeared in v7.0-rc5, so I put this on pci/for-linus for
> v7.0, thanks!
>
> Would you also take a look at pwrseq_pcie_m2_match()? It can
> similarly return early from a for_each_endpoint_of_node() loop, so I'm
> concerned it may have a similar issue.
Hi Bjorn,
pwrseq_pcie_m2_match should be fine, endpoint is marked as __free(device_node),
it will be called of_node_put() automatically when returning early.
Best regards,
Felix