* [PATCH] irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()
@ 2025-12-09 6:54 Dan Carpenter
2025-12-09 9:27 ` Claudiu Beznea
2025-12-10 3:14 ` [tip: irq/urgent] " tip-bot2 for Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-12-09 6:54 UTC (permalink / raw)
To: Claudiu Beznea
Cc: Thomas Gleixner, Marc Zyngier, linux-arm-kernel, linux-kernel,
kernel-janitors
If the irq_domain_translate_twocell() function sets "hwirq" to >=
MCHP_EIC_NIRQ (2) then it would result in an out of bounds access.
The code here checks for invalid values, but doesn't set the error
code. Return -EINVAL in that case, instead of returning success.
Fixes: 00fa3461c86d ("irqchip/mchp-eic: Add support for the Microchip EIC")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/irqchip/irq-mchp-eic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c
index 2474fa467a05..31093a8ab67c 100644
--- a/drivers/irqchip/irq-mchp-eic.c
+++ b/drivers/irqchip/irq-mchp-eic.c
@@ -170,7 +170,7 @@ static int mchp_eic_domain_alloc(struct irq_domain *domain, unsigned int virq,
ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
if (ret || hwirq >= MCHP_EIC_NIRQ)
- return ret;
+ return ret ?: -EINVAL;
switch (type) {
case IRQ_TYPE_EDGE_RISING:
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()
2025-12-09 6:54 [PATCH] irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc() Dan Carpenter
@ 2025-12-09 9:27 ` Claudiu Beznea
2025-12-10 3:14 ` [tip: irq/urgent] " tip-bot2 for Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Claudiu Beznea @ 2025-12-09 9:27 UTC (permalink / raw)
To: Dan Carpenter
Cc: Thomas Gleixner, Marc Zyngier, linux-arm-kernel, linux-kernel,
kernel-janitors
On 12/9/25 08:54, Dan Carpenter wrote:
> If the irq_domain_translate_twocell() function sets "hwirq" to >=
> MCHP_EIC_NIRQ (2) then it would result in an out of bounds access.
> The code here checks for invalid values, but doesn't set the error
> code. Return -EINVAL in that case, instead of returning success.
>
> Fixes: 00fa3461c86d ("irqchip/mchp-eic: Add support for the Microchip EIC")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: irq/urgent] irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()
2025-12-09 6:54 [PATCH] irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc() Dan Carpenter
2025-12-09 9:27 ` Claudiu Beznea
@ 2025-12-10 3:14 ` tip-bot2 for Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Dan Carpenter @ 2025-12-10 3:14 UTC (permalink / raw)
To: linux-tip-commits
Cc: Dan Carpenter, Thomas Gleixner, Claudiu Beznea, x86, linux-kernel,
maz
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 7dbc0d40d8347bd9de55c904f59ea44bcc8dedb7
Gitweb: https://git.kernel.org/tip/7dbc0d40d8347bd9de55c904f59ea44bcc8dedb7
Author: Dan Carpenter <dan.carpenter@linaro.org>
AuthorDate: Tue, 09 Dec 2025 09:54:16 +03:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 10 Dec 2025 12:11:06 +09:00
irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc()
If irq_domain_translate_twocell() sets "hwirq" to >= MCHP_EIC_NIRQ (2) then
it results in an out of bounds access.
The code checks for invalid values, but doesn't set the error code. Return
-EINVAL in that case, instead of returning success.
Fixes: 00fa3461c86d ("irqchip/mchp-eic: Add support for the Microchip EIC")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://patch.msgid.link/aTfHmOz6IBpTIPU5@stanley.mountain
---
drivers/irqchip/irq-mchp-eic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-mchp-eic.c b/drivers/irqchip/irq-mchp-eic.c
index 2474fa4..31093a8 100644
--- a/drivers/irqchip/irq-mchp-eic.c
+++ b/drivers/irqchip/irq-mchp-eic.c
@@ -170,7 +170,7 @@ static int mchp_eic_domain_alloc(struct irq_domain *domain, unsigned int virq,
ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type);
if (ret || hwirq >= MCHP_EIC_NIRQ)
- return ret;
+ return ret ?: -EINVAL;
switch (type) {
case IRQ_TYPE_EDGE_RISING:
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-10 3:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09 6:54 [PATCH] irqchip/mchp-eic: Fix error code in mchp_eic_domain_alloc() Dan Carpenter
2025-12-09 9:27 ` Claudiu Beznea
2025-12-10 3:14 ` [tip: irq/urgent] " tip-bot2 for Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.