* [PATCH] genirq/msi: Fix fwnode leak
@ 2023-01-25 23:13 Alex Williamson
2023-01-26 8:10 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Alex Williamson @ 2023-01-25 23:13 UTC (permalink / raw)
To: maz, tglx; +Cc: linux-kernel, linux-pci, alex.williamson
kmemleak is reporting pairs of leaked buffers when PCI devices are
unbound from their drivers. One of these buffers contains the name of
the interrupt as generated for the msi_domain_template bundle in
msi_create_device_irq_domain(). This name is passed through
irq_domain_alloc_named_fwnode(), where an irqchip_rwid is allocated,
along with a separate allocation via kasprintf() for another copy of
the name. These are the two leaked buffers.
Resolve this by adding the missing call to irq_domain_free_fwnode() in
msi_remove_device_irq_domain().
Fixes: 27a6dea3ebaa ("genirq/msi: Provide msi_create/free_device_irq_domain()")
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
kernel/irq/msi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
index 955267bbc2be..66dc956505b8 100644
--- a/kernel/irq/msi.c
+++ b/kernel/irq/msi.c
@@ -1015,6 +1015,7 @@ void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
{
struct msi_domain_info *info;
struct irq_domain *domain;
+ struct fwnode_handle *fwnode;
msi_lock_descs(dev);
@@ -1025,7 +1026,9 @@ void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
dev->msi.data->__domains[domid].domain = NULL;
info = domain->host_data;
+ fwnode = domain->fwnode;
irq_domain_remove(domain);
+ irq_domain_free_fwnode(fwnode);
kfree(container_of(info, struct msi_domain_template, info));
unlock:
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] genirq/msi: Fix fwnode leak
2023-01-25 23:13 [PATCH] genirq/msi: Fix fwnode leak Alex Williamson
@ 2023-01-26 8:10 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2023-01-26 8:10 UTC (permalink / raw)
To: Alex Williamson; +Cc: tglx, linux-kernel, linux-pci
On Wed, 25 Jan 2023 23:13:48 +0000,
Alex Williamson <alex.williamson@redhat.com> wrote:
>
> kmemleak is reporting pairs of leaked buffers when PCI devices are
> unbound from their drivers. One of these buffers contains the name of
> the interrupt as generated for the msi_domain_template bundle in
> msi_create_device_irq_domain(). This name is passed through
> irq_domain_alloc_named_fwnode(), where an irqchip_rwid is allocated,
> along with a separate allocation via kasprintf() for another copy of
> the name. These are the two leaked buffers.
>
> Resolve this by adding the missing call to irq_domain_free_fwnode() in
> msi_remove_device_irq_domain().
>
> Fixes: 27a6dea3ebaa ("genirq/msi: Provide msi_create/free_device_irq_domain()")
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Thomas has already queued this:
commit ac8f29aef2f1695956ff6773b33f975290437f29 (tip/irq/urgent)
Author: Jason Gunthorpe <jgg@ziepe.ca>
Date: Tue Jan 17 15:16:17 2023 -0400
genirq/msi: Free the fwnode created by msi_create_device_irq_domain()
which I assume will make it into Linus' tree shortly.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-26 8:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-25 23:13 [PATCH] genirq/msi: Fix fwnode leak Alex Williamson
2023-01-26 8:10 ` Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).