archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <>
Subject: [PATCH] genirq/msi: Fix fwnode leak
Date: Wed, 25 Jan 2023 16:13:48 -0700	[thread overview]
Message-ID: <167468839713.2297784.1309086853550595503.stgit@omen> (raw)

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

Fixes: 27a6dea3ebaa ("genirq/msi: Provide msi_create/free_device_irq_domain()")
Signed-off-by: Alex Williamson <>
 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;
@@ -1025,7 +1026,9 @@ void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
 	dev->>__domains[domid].domain = NULL;
 	info = domain->host_data;
+	fwnode = domain->fwnode;
+	irq_domain_free_fwnode(fwnode);
 	kfree(container_of(info, struct msi_domain_template, info));

             reply	other threads:[~2023-01-25 23:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 23:13 Alex Williamson [this message]
2023-01-26  8:10 ` [PATCH] genirq/msi: Fix fwnode leak Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=167468839713.2297784.1309086853550595503.stgit@omen \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).