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: <aJSs6dxHIYIGIH0Z@lpieralisi>
Date: Thu, 7 Aug 2025 15:40:57 +0200
From: Lorenzo Pieralisi <lpieralisi@...nel.org>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, Rob Herring <robh@...nel.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Marc Zyngier <maz@...nel.org>
Subject: Re: [PATCH] irqchip/msi-lib: Fix fwnode refcount in
 msi_lib_irq_domain_select()

On Wed, Aug 06, 2025 at 03:08:18PM +0100, Jonathan Cameron wrote:
> On Tue, 5 Aug 2025 11:23:04 +0200
> Lorenzo Pieralisi <lpieralisi@...nel.org> wrote:
> 
> > On Tue, Aug 05, 2025 at 10:31:32AM +0200, Thomas Gleixner wrote:
> > > On Mon, Aug 04 2025 at 16:55, Lorenzo Pieralisi wrote:  
> > > >
> > > > msi_lib_irq_domain_select() is used in other arches, I could not
> > > > test on those (don't know if they have non-[DT/irqchip/acpi] specific
> > > > fwnodes) - from a fwnode interface perspective I think that this patch
> > > > does the right thing, it should not add any issue to existing code
> > > > to the best of my knowledge but it has to be verified.  
> > > 
> > > fwnode handles are architecture and firmware agnostic.  
> > 
> > Yep, though to make sure this does not trigger regressions I started
> > checking (ie I am adding an additional fwnode_handle_get/put() in there),
> > some fwnode helpers (eg fwnode_find_reference()) returns an error
> > pointer rather than NULL on error, it looks like calling
> > fwnode_handle_put() on that value when OF is in use is not a good idea
> > (ie of_node_put() checks for NULL and dereference).
> > 
> > There is code out there that implicitly assumes what fwnode types
> > are used behind the fwnode_* interface or I am missing something.
> > 
> > It is not arch dependent but it looks like it depends on what fwnodes
> > arches use - that's where my caution stems from, nothing else.
> > 
> 
> For the many DEFINE_FREE() uses there is a check of IS_ERR_OR_NULL()
> 
> E.g. Here it would be 
> DEFINE_FREE(fwnode_handle, struct fwnode_handle *, if (!IS_ERR_OR_NULL(_T)) fwnode_handle_put(_T));
> 
> IIRC this one was an early use of DEFINE_FREE() and later discussions
> argued for always adding that check purely to allow the compiler
> to potentially optimize away the call.  Sounds like it would be
> more generally helpful here and I can't immediately spot any negatives.

Neither can I - at present I don't think that's a real problem
(ie we would have noticed) but we can add the additional check
you suggested above.

Thanks,
Lorenzo

> 
> Jonathan
> 
> 
> > Thanks,
> > Lorenzo
> > 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ