mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq/core: Propagate IRQ descriptor range search errors
@ 2026-10-31 20:22 Avi Weiss
  0 siblings, 0 replies; only message in thread
From: Avi Weiss @ 2026-10-31 20:22 UTC (permalink / raw)
  To: tglx; +Cc: radu, sdonthineni, linux-kernel, Avi Weiss

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 <thnkslprpt@gmail.com>
---
 kernel/irq/irqdesc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 7cbcc3fb9e6d..651f34dae034 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -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
-- 
2.53.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-31 20:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 20:22 [PATCH] genirq/core: Propagate IRQ descriptor range search errors Avi Weiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®