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] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fsc9knog.ffs@tglx>
Date:   Tue, 17 Jan 2023 19:42:39 +0100
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Jason Gunthorpe <jgg@...dia.com>
Cc:     Kevin Tian <kevin.tian@...el.com>, Kalle Valo <kvalo@...nel.org>,
        Leon Romanovsky <leonro@...dia.com>,
        Marc Zyngier <maz@...nel.org>,
        Omri Barazi <obarazi@...dia.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH rc] genirq/msi: Free the fwnode created by
 msi_create_device_irq_domain()

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);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ