Skip to content

Commit 2a20b08

Browse files
Marc Zyngierctmarinas
authored andcommitted
ACPI: irq: Prevent unregistering of GIC SGIs
When using ACPI on arm64, which implies the GIC IRQ model, no table should ever provide a GSI number in the range [0:15], as these are reserved for IPIs. However, drivers tend to call acpi_unregister_gsi() with any random GSI number provided by half baked tables, which results in an exploding kernel when its IPIs have been unconfigured. In order to catch this, check for the silly case early, warn that something is going wrong and avoid the above disaster. Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Sudeep Holla <[email protected]> Tested-by: dann frazier <[email protected]> Tested-by: Hanjun Guo <[email protected]> Reviewed-by: Hanjun Guo <[email protected]> Reviewed-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 1ecd5b1 commit 2a20b08

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/acpi/irq.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ void acpi_unregister_gsi(u32 gsi)
7575
{
7676
struct irq_domain *d = irq_find_matching_fwnode(acpi_gsi_domain_id,
7777
DOMAIN_BUS_ANY);
78-
int irq = irq_find_mapping(d, gsi);
78+
int irq;
7979

80+
if (WARN_ON(acpi_irq_model == ACPI_IRQ_MODEL_GIC && gsi < 16))
81+
return;
82+
83+
irq = irq_find_mapping(d, gsi);
8084
irq_dispose_mapping(irq);
8185
}
8286
EXPORT_SYMBOL_GPL(acpi_unregister_gsi);

0 commit comments

Comments
 (0)