mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: tglx@kernel.org
Cc: radu@rendec.net, sdonthineni@nvidia.com,
	linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] genirq/core: Propagate IRQ descriptor range search errors
Date: Sat, 31 Oct 2026 22:22:54 +0200	[thread overview]
Message-ID: <20261031202254.200628-1-thnkslprpt@gmail.com> (raw)

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


                 reply	other threads:[~2026-10-31 20:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261031202254.200628-1-thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=radu@rendec.net \
    --cc=sdonthineni@nvidia.com \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®