Jason, On Wed, Jan 04 2023 at 08:34, Jason Gunthorpe wrote: > Our test team has discovered some kmem leak complaints on rc1 and > bisected it to this patch. > > I don't see an obvious way that fwnode gets destroyed here. So maybe > it should be like this? > > diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c > index 955267bbc2be63..cbbcb7fd2bd00d 100644 > --- a/kernel/irq/msi.c > +++ b/kernel/irq/msi.c > @@ -1000,7 +1000,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, > fail: > msi_unlock_descs(dev); > free_fwnode: > - kfree(fwnode); > + irq_domain_free_fwnode(fwnode); // ??? That's correct. kfree(fwnode) leaks fwnode->name > free_bundle: > kfree(bundle); > return false; > @@ -1013,6 +1013,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid, > */ > void msi_remove_device_irq_domain(struct device *dev, unsigned int domid) > { > + struct fwnode_handle *fwnode = NULL; > struct msi_domain_info *info; > struct irq_domain *domain; > > @@ -1025,7 +1026,10 @@ void msi_remove_device_irq_domain(struct device *dev, unsigned int domid) > > dev->msi.data->__domains[domid].domain = NULL; > info = domain->host_data; > + if (domain->flags & IRQ_DOMAIN_FLAG_MSI_DEVICE) > + fwnode = domain->fwnode; irq_domain_is_msi_device() ? > irq_domain_remove(domain); > + irq_domain_free_fwnode(fwnode); For some reason I thought the fwnode would be handled by irq_domain_remove() but fwnode_handle_put() is a NOP for the named fwnodes. Care to send a proper patch with changelog? Thanks, tglx