mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-05-23 14:21:32 +01:00
lib: sbi_irqchip: Check full range for existing handlers in sbi_irqchip_register_handler()
Currently, the sbi_irqchip_register_handler() only checks the first and the
last hardware interrupt for existing handlers which is buggy because there
may be existing handlers between the first and the last hardware interrupt.
Fixes: 0ab0c470d5 ("lib: sbi_irqchip: Allow registering interrupt handlers")
Signed-off-by: Anup Patel <anup.patel@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20260423052339.356900-2-anup.patel@oss.qualcomm.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
@@ -149,12 +149,11 @@ int sbi_irqchip_register_handler(struct sbi_irqchip_device *chip,
|
||||
chip->num_hwirq <= (first_hwirq + num_hwirq - 1))
|
||||
return SBI_EBAD_RANGE;
|
||||
|
||||
h = sbi_irqchip_find_handler(chip, first_hwirq);
|
||||
if (h)
|
||||
return SBI_EALREADY;
|
||||
h = sbi_irqchip_find_handler(chip, first_hwirq + num_hwirq - 1);
|
||||
for (i = first_hwirq; i < (first_hwirq + num_hwirq); i++) {
|
||||
h = sbi_irqchip_find_handler(chip, i);
|
||||
if (h)
|
||||
return SBI_EALREADY;
|
||||
}
|
||||
|
||||
h = sbi_zalloc(sizeof(*h));
|
||||
if (!h)
|
||||
|
||||
Reference in New Issue
Block a user