mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 01:32:21 +02:00
irqchip/irq-riscv-imsic-early: Fix fwnode leak on state setup failure
imsic_early_acpi_init() allocates a firmware node 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.
[ tglx: Use a common cleanup path instead of copying code around ]
Fixes: fbe826b1c1 ("irqchip/riscv-imsic: Add ACPI support")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260623073744.2009137-1-haoxiang_li2024@163.com
This commit is contained in:
parent
dc59e4fea9
commit
1358126fbe
|
|
@ -272,16 +272,13 @@ 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);
|
||||
return rc;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Do early setup of IMSIC state and IPIs */
|
||||
rc = imsic_early_probe(imsic_acpi_fwnode);
|
||||
if (rc) {
|
||||
irq_domain_free_fwnode(imsic_acpi_fwnode);
|
||||
imsic_acpi_fwnode = NULL;
|
||||
return rc;
|
||||
}
|
||||
if (rc)
|
||||
goto cleanup;
|
||||
|
||||
rc = imsic_platform_acpi_probe(imsic_acpi_fwnode);
|
||||
|
||||
|
|
@ -300,8 +297,12 @@ static int __init imsic_early_acpi_init(union acpi_subtable_headers *header,
|
|||
* DT where IPI works but MSI probe fails for some reason.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
irq_domain_free_fwnode(imsic_acpi_fwnode);
|
||||
imsic_acpi_fwnode = NULL;
|
||||
return rc;
|
||||
}
|
||||
IRQCHIP_ACPI_DECLARE(riscv_imsic, ACPI_MADT_TYPE_IMSIC, NULL,
|
||||
1, imsic_early_acpi_init);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user