]> git.baikalelectronics.ru Git - kernel.git/commit
irqdomain/treewide: Keep firmware node unconditionally allocated
authorThomas Gleixner <tglx@linutronix.de>
Thu, 9 Jul 2020 09:53:06 +0000 (11:53 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 14 Jul 2020 15:44:42 +0000 (17:44 +0200)
commit1dec9106b77892095e2010176e623d4c9bbe8f31
tree65c253af1f9b2531f1129f5223b8e221542183dc
parent7952384771d28acf3a2e59e7e19595e6dca1c650
irqdomain/treewide: Keep firmware node unconditionally allocated

Quite some non OF/ACPI users of irqdomains allocate firmware nodes of type
IRQCHIP_FWNODE_NAMED or IRQCHIP_FWNODE_NAMED_ID and free them right after
creating the irqdomain. The only purpose of these FW nodes is to convey
name information. When this was introduced the core code did not store the
pointer to the node in the irqdomain. A recent change stored the firmware
node pointer in irqdomain for other reasons and missed to notice that the
usage sites which do the alloc_fwnode/create_domain/free_fwnode sequence
are broken by this. Storing a dangling pointer is dangerous itself, but in
case that the domain is destroyed later on this leads to a double free.

Remove the freeing of the firmware node after creating the irqdomain from
all affected call sites to cure this.

Fixes: e764624f8b9c ("irqdomain: Add the missing assignment of domain->fwnode for named fwnode")
Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/873661qakd.fsf@nanos.tec.linutronix.de
arch/mips/pci/pci-xtalk-bridge.c
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/apic/msi.c
arch/x86/kernel/apic/vector.c
arch/x86/platform/uv/uv_irq.c
drivers/iommu/amd/iommu.c
drivers/iommu/hyperv-iommu.c
drivers/iommu/intel/irq_remapping.c
drivers/mfd/ioc3.c
drivers/pci/controller/vmd.c