From: Thomas Gleixner <tglx@linutronix.de>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Kalle Valo <kvalo@kernel.org>,
Leon Romanovsky <leonro@nvidia.com>,
Marc Zyngier <maz@kernel.org>, Omri Barazi <obarazi@nvidia.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH rc] genirq/msi: Free the fwnode created by msi_create_device_irq_domain()
Date: Tue, 17 Jan 2023 19:42:39 +0100 [thread overview]
Message-ID: <87fsc9knog.ffs@tglx> (raw)
In-Reply-To: <0-v1-9195b42af947+89-msi_leak_jgg@nvidia.com>
Jason!
On Tue, Jan 17 2023 at 11:27, Jason Gunthorpe wrote:
> 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 (irq_domain_is_msi_device(domain))
> + fwnode = domain->fwnode;
> irq_domain_remove(domain);
> + irq_domain_free_fwnode(fwnode);
This can't work with !device domains because then fwnode is NULL and
irq_domain_free_fwnode() will trip over its feet.
Instead of checking the NULL pointer here, we can just make
irq_domain_free_fwnode() NULL pointer tolerant. See below.
Thanks,
tglx
---
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -114,7 +114,7 @@ void irq_domain_free_fwnode(struct fwnod
{
struct irqchip_fwid *fwid;
- if (WARN_ON(!is_fwnode_irqchip(fwnode)))
+ if (!fwnode || WARN_ON(!is_fwnode_irqchip(fwnode)))
return;
fwid = container_of(fwnode, struct irqchip_fwid, fwnode);
next prev parent reply other threads:[~2023-01-17 19:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 15:27 [PATCH rc] genirq/msi: Free the fwnode created by msi_create_device_irq_domain() Jason Gunthorpe
2023-01-17 18:42 ` Thomas Gleixner [this message]
2023-01-17 19:10 ` Jason Gunthorpe
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsc9knog.ffs@tglx \
--to=tglx@linutronix.de \
--cc=jgg@nvidia.com \
--cc=kevin.tian@intel.com \
--cc=kvalo@kernel.org \
--cc=leonro@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=obarazi@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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