mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
irqchip/riscv-intc: Prevent memory leak when riscv_intc_init_common() fails
[ Upstream commit0110c4b110
] 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: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
85ca483e72
commit
1c88d94a7a
1 changed files with 7 additions and 2 deletions
|
@ -232,8 +232,9 @@ IRQCHIP_DECLARE(andes, "andestech,cpu-intc", riscv_intc_init);
|
||||||
static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header,
|
static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header,
|
||||||
const unsigned long end)
|
const unsigned long end)
|
||||||
{
|
{
|
||||||
struct fwnode_handle *fn;
|
|
||||||
struct acpi_madt_rintc *rintc;
|
struct acpi_madt_rintc *rintc;
|
||||||
|
struct fwnode_handle *fn;
|
||||||
|
int rc;
|
||||||
|
|
||||||
rintc = (struct acpi_madt_rintc *)header;
|
rintc = (struct acpi_madt_rintc *)header;
|
||||||
|
|
||||||
|
@ -252,7 +253,11 @@ static int __init riscv_intc_acpi_init(union acpi_subtable_headers *header,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return riscv_intc_init_common(fn, &riscv_intc_chip);
|
rc = riscv_intc_init_common(fn, &riscv_intc_chip);
|
||||||
|
if (rc)
|
||||||
|
irq_domain_free_fwnode(fn);
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
IRQCHIP_ACPI_DECLARE(riscv_intc, ACPI_MADT_TYPE_RINTC, NULL,
|
IRQCHIP_ACPI_DECLARE(riscv_intc, ACPI_MADT_TYPE_RINTC, NULL,
|
||||||
|
|
Loading…
Reference in a new issue