[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220509063206.3147124-3-yangyingliang@huawei.com>
Date: Mon, 9 May 2022 14:32:06 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
CC: <tglx@...utronix.de>, <maz@...nel.org>
Subject: [PATCH 3/3] irqchip/gic-v3: fix possible memory leak in gic_populate_ppi_part()
'ppi_descs' should be freed in error path in gic_populate_ppi_part().
Fixes: 52085d3f2028 ("irqchip/gic-v3: Dynamically allocate PPI partition descriptors")
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
drivers/irqchip/irq-gic-v3.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 0e23dc8bafcf..3264fef89360 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -1871,11 +1871,11 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
nr_parts = of_get_child_count(parts_node);
if (!nr_parts)
- goto out_put_node;
+ goto out_free_ppi_descs;
parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL);
if (WARN_ON(!parts))
- goto out_put_node;
+ goto out_free_ppi_descs;
for_each_child_of_node(parts_node, child_part) {
struct partition_affinity *part;
@@ -1946,6 +1946,9 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
gic_data.ppi_descs[i] = desc;
}
+out_free_ppi_descs:
+ kfree(gic_data.ppi_descs);
+ gic_data.ppi_descs = NULL;
out_put_node:
of_node_put(parts_node);
}
--
2.25.1
Powered by blists - more mailing lists