lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aO/FWzJggZ16maGr@lizhi-Precision-Tower-5810>
Date: Wed, 15 Oct 2025 12:01:31 -0400
From: Frank Li <Frank.li@....com>
To: Lorenzo Pieralisi <lpieralisi@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	devicetree@...r.kernel.org, linux-pci@...r.kernel.org,
	Rob Herring <robh@...nel.org>,
	Sascha Bischoff <sascha.bischoff@....com>,
	Scott Branden <sbranden@...adcom.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Bjorn Helgaas <bhelgaas@...gle.com>, Ray Jui <rjui@...adcom.com>,
	Manivannan Sadhasivam <mani@...nel.org>,
	Krzysztof WilczyƄski <kwilczynski@...nel.org>,
	Marc Zyngier <maz@...nel.org>
Subject: Re: [PATCH v2 2/4] of/irq: Fix OF node refcount in
 of_msi_get_domain()

On Wed, Oct 15, 2025 at 10:03:44AM +0200, Lorenzo Pieralisi wrote:
> On Tue, Oct 14, 2025 at 06:20:55PM -0400, Frank Li wrote:
> > On Tue, Oct 14, 2025 at 11:58:43AM +0200, Lorenzo Pieralisi wrote:
> > > In of_msi_get_domain() if the iterator loop stops early because an
> > > irq_domain match is detected, an of_node_put() on the iterator node is
> > > needed to keep the OF node refcount in sync.
> > >
> > > Add it.
> > >
> > > Signed-off-by: Lorenzo Pieralisi <lpieralisi@...nel.org>
> > > Cc: Rob Herring <robh@...nel.org>
> > > ---
> >
> > Reviewed-by: Frank Li <Frank.Li@....com>
> >
> > After go though of_for_each_phandle, I understand why need of_node_put()
> > at break branch.
> >
> > It will be nice if add of_for_each_phandle_scoped() help macro.
>
> Yes because this fix is not the end of it AFAICS.
>
> Please review and test patch (4) as well since I slightly change
> the existing logic there, I don't want to break the EP mapping code you
> added in f1680d9081e1 (by the way, I don't get that commit logic, if the
> msi-parent loop would match it could just return and we could have
> removed the
>
> if (ret)
>
> guarding of_map_id(), correct ?).
>
> That's what I did in patch (4), please have a look.

It looks correct. PCIE-EP use msi-map. There are comments from Marc Zyngier.
Suppose you will update new version. I will test after new version posted.

Frank
>
> Thanks,
> Lorenzo
>
> >
> >
> > >  drivers/of/irq.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c
> > > index e67b2041e73b..9f6cd5abba76 100644
> > > --- a/drivers/of/irq.c
> > > +++ b/drivers/of/irq.c
> > > @@ -773,8 +773,10 @@ struct irq_domain *of_msi_get_domain(struct device *dev,
> > >
> > >  	of_for_each_phandle(&it, err, np, "msi-parent", "#msi-cells", 0) {
> > >  		d = irq_find_matching_host(it.node, token);
> > > -		if (d)
> > > +		if (d) {
> > > +			of_node_put(it.node);
> > >  			return d;
> > > +		}
> > >  	}
> > >
> > >  	return NULL;
> > > --
> > > 2.50.1
> > >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ