Skip to content

Commit c16ae60

Browse files
AntonioBorneoMarc Zyngier
authored andcommitted
irqchip/stm32-exti: Prevent illegal read due to unbounded DT value
The value hwirq is received from DT. If it exceeds the maximum valid value it causes the code to address unexisting irq chips reading outside the array boundary. Check the value of hwirq before using it. Signed-off-by: Antonio Borneo <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent f8b3eb4 commit c16ae60

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/irqchip/irq-stm32-exti.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
713713
int bank;
714714

715715
hwirq = fwspec->param[0];
716+
if (hwirq >= host_data->drv_data->bank_nr * IRQS_PER_BANK)
717+
return -EINVAL;
718+
716719
bank = hwirq / IRQS_PER_BANK;
717720
chip_data = &host_data->chips_data[bank];
718721

0 commit comments

Comments
 (0)