irqchip/riscv-intc: Prevent memory leak when riscv_intc_init_common() fails
BugLink: https://bugs.launchpad.net/bugs/2073788
commit 0110c4b110477bb1f19b0d02361846be7ab08300 upstream.
When riscv_intc_init_common() fails, the firmware node allocated is not
freed. Add the missing free().
Fixes: 7023b9d83f ("irqchip/riscv-intc: Add ACPI support")
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240527081113.616189-1-sunilvl@ventanamicro.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Portia Stephens <portia.stephens@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
This commit is contained in:
committed by
Roxana Nicolescu
parent
1859390830
commit
a914d7ee9e
@@ -176,8 +176,9 @@ IRQCHIP_DECLARE(riscv, "riscv,cpu-intc", riscv_intc_init);
|
||||
static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header,
|
||||
const unsigned long end)
|
||||
{
|
||||
struct fwnode_handle *fn;
|
||||
struct acpi_madt_rintc *rintc;
|
||||
struct fwnode_handle *fn;
|
||||
int rc;
|
||||
|
||||
rintc = (struct acpi_madt_rintc *)header;
|
||||
|
||||
@@ -196,7 +197,11 @@ static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header,
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return riscv_intc_init_common(fn);
|
||||
rc = riscv_intc_init_common(fn);
|
||||
if (rc)
|
||||
irq_domain_free_fwnode(fn);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
IRQCHIP_ACPI_DECLARE(riscv_intc, ACPI_MADT_TYPE_RINTC, NULL,
|
||||
|
||||
Reference in New Issue
Block a user