genirq/core: Propagate IRQ descriptor range search errors
PATCH 1/1 genirq/core: Propagate IRQ descriptor range search errors
irq_find_free_area() returns -ENOSPC when no suitable IRQ range is available. __irq_alloc_descs() uses the negative result without checking for errors. The unsigned count can cause start + cnt to wrap, allowing descriptor allocation with an invalid IRQ number.
Return the search error before using the result in range arithmetic.
Fixes 721255b9826b ("genirq: Use a maple tree for interrupt descriptor management")
Signed-off-by Avi Weiss <[email protected]>
--- kernel/irq/irqdesc.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/irq/irqdesc.c +2 -0
@@ -922,6 +922,8 @@ int __ref __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int no start =irq_find_free_area (from, cnt);if (irq >=0 && start != irq)return -EEXIST ; +if (start <0 ) +return start;if (start + cnt > total_nr_irqs) {if (!irq_expand_nr_irqs (start + cnt))
base-commit: e9954f3fbddd25e1a01b7e5a0b72fb8b564204e0
Signature · 1 line
2.53.0