[PATCH] irqchip/irq-riscv-imsic-early: Fix fwnode leak on state setup failure

Haoxiang Li haoxiang_li2024 at 163.com
Tue Jun 23 00:37:44 PDT 2026


imsic_early_acpi_init() allocates a firmware node with
irq_domain_alloc_named_fwnode() before setting up the
IMSIC state. If imsic_setup_state() fails, the function
returns without freeing the allocated fwnode.

Free the fwnode and clear the global pointer on this
error path, matching the cleanup already done when
imsic_early_probe() fails.

Fixes: fbe826b1c106 ("irqchip/riscv-imsic: Add ACPI support")
Cc: stable at vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024 at 163.com>
---
 drivers/irqchip/irq-riscv-imsic-early.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/irqchip/irq-riscv-imsic-early.c b/drivers/irqchip/irq-riscv-imsic-early.c
index a7a1852b548c..b7cbfee3aeb2 100644
--- a/drivers/irqchip/irq-riscv-imsic-early.c
+++ b/drivers/irqchip/irq-riscv-imsic-early.c
@@ -272,6 +272,8 @@ static int __init imsic_early_acpi_init(union acpi_subtable_headers *header,
 	rc = imsic_setup_state(imsic_acpi_fwnode, imsic);
 	if (rc) {
 		pr_err("%pfwP: failed to setup state (error %d)\n", imsic_acpi_fwnode, rc);
+		irq_domain_free_fwnode(imsic_acpi_fwnode);
+		imsic_acpi_fwnode = NULL;
 		return rc;
 	}
 
-- 
2.25.1




More information about the linux-riscv mailing list