diff options
| author | Anup Patel <anup.patel@oss.qualcomm.com> | 2026-04-23 10:53:34 +0530 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2026-05-12 09:55:58 +0530 |
| commit | 0d81a78ec54be2f7c62906b1aa945240ce519c6b (patch) | |
| tree | 6367e6ee9df90d4074b9215468d64c7fac6f830a /lib | |
| parent | 9595829a336793744f56b978b2651350d0a1723b (diff) | |
| download | opensbi-0d81a78ec54be2f7c62906b1aa945240ce519c6b.tar.gz opensbi-0d81a78ec54be2f7c62906b1aa945240ce519c6b.zip | |
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: 0ab0c470d588 ("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>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sbi/sbi_irqchip.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/sbi/sbi_irqchip.c b/lib/sbi/sbi_irqchip.c index f0744830..503958e1 100644 --- a/lib/sbi/sbi_irqchip.c +++ b/lib/sbi/sbi_irqchip.c @@ -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); - if (h) - return SBI_EALREADY; + 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) |
