mirror of
https://github.com/torvalds/linux.git
synced 2026-09-26 01:52:03 +02:00
irqchip/gic-v5: Clear per-CPU IRS data on teardown
IRS affinity setup publishes an IRS pointer and IAFFID state in the per-CPU data before the remaining IRS initialization can fail. The error path then frees the IRS data without clearing that published state, leaving CPUs associated with freed memory. On initialization failure and normal IRS teardown, clear the per-CPU IRS association by removing the stale pointer to irs_data. Also invalidate the per-CPU IAFFID state for any CPUs that were tied to the IRS before it was freed. Fixes:5cb1b6dab2("irqchip/gic-v5: Add GICv5 IRS/SPI support") Fixes:35866efa52("irqchip/gic-v5: Add ACPI IRS probing") Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Reviewed-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Link: https://sashiko.dev/#/patchset/20260724104819.1296803-1-sascha.bischoff@arm.com?part=2 Link: https://patch.msgid.link/20260811152630.942023-2-sascha.bischoff@arm.com
This commit is contained in:
parent
34b7e953d1
commit
3dfc0ab5fe
|
|
@ -651,6 +651,18 @@ static int __init gicv5_irs_of_init_affinity(struct device_node *node,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void __init gicv5_irs_clear_affinity(struct gicv5_irs_chip_data *irs_data)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
if (per_cpu(per_cpu_irs_data, cpu) == irs_data) {
|
||||
per_cpu(cpu_iaffid, cpu).valid = false;
|
||||
per_cpu(per_cpu_irs_data, cpu) = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void irs_setup_pri_bits(u32 idr1)
|
||||
{
|
||||
switch (FIELD_GET(GICV5_IRS_IDR1_PRIORITY_BITS, idr1)) {
|
||||
|
|
@ -773,6 +785,7 @@ static int __init gicv5_irs_of_init(struct device_node *node)
|
|||
return ret;
|
||||
|
||||
out_iomem:
|
||||
gicv5_irs_clear_affinity(irs_data);
|
||||
iounmap(irs_base);
|
||||
out_err:
|
||||
kfree(irs_data);
|
||||
|
|
@ -787,6 +800,7 @@ void __init gicv5_irs_remove(void)
|
|||
gicv5_deinit_lpis();
|
||||
|
||||
list_for_each_entry_safe(irs_data, tmp_data, &irs_nodes, entry) {
|
||||
gicv5_irs_clear_affinity(irs_data);
|
||||
iounmap(irs_data->irs_base);
|
||||
list_del(&irs_data->entry);
|
||||
kfree(irs_data);
|
||||
|
|
@ -951,6 +965,7 @@ static int __init gic_acpi_parse_madt_irs(union acpi_subtable_headers *header,
|
|||
return 0;
|
||||
|
||||
out_map:
|
||||
gicv5_irs_clear_affinity(irs_data);
|
||||
iounmap(irs_base);
|
||||
out_release:
|
||||
release_mem_region(r->start, resource_size(r));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user