[PATCH] gpio: ljca: Fix duplicated IRQ mapping

Haotian Zhang posted 1 patch 3 months, 2 weeks ago
drivers/gpio/gpio-ljca.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
[PATCH] gpio: ljca: Fix duplicated IRQ mapping
Posted by Haotian Zhang 3 months, 2 weeks ago
The generic_handle_domain_irq() function resolves the hardware IRQ
internally. The driver performed a duplicative mapping by calling
irq_find_mapping() first, which could lead to an RCU stall.

Delete the redundant irq_find_mapping() call and pass the hardware IRQ
directly to generic_handle_domain_irq().

Fixes: c5a4b6fd31e8 ("gpio: Add support for Intel LJCA USB GPIO driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/gpio/gpio-ljca.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-ljca.c b/drivers/gpio/gpio-ljca.c
index 3b4f8830c741..cc67f3db7ecd 100644
--- a/drivers/gpio/gpio-ljca.c
+++ b/drivers/gpio/gpio-ljca.c
@@ -292,16 +292,8 @@ static void ljca_gpio_event_cb(void *context, u8 cmd, const void *evt_data,
 		return;
 
 	for (i = 0; i < packet->num; i++) {
-		irq = irq_find_mapping(ljca_gpio->gc.irq.domain,
-				       packet->item[i].index);
-		if (!irq) {
-			dev_err(ljca_gpio->gc.parent,
-				"gpio_id %u does not mapped to IRQ yet\n",
-				packet->item[i].index);
-			return;
-		}
-
-		generic_handle_domain_irq(ljca_gpio->gc.irq.domain, irq);
+		generic_handle_domain_irq(ljca_gpio->gc.irq.domain,
+					packet->item[i].index);
 		set_bit(packet->item[i].index, ljca_gpio->reenable_irqs);
 	}
 
-- 
2.25.1
Re: [PATCH] gpio: ljca: Fix duplicated IRQ mapping
Posted by Bartosz Golaszewski 3 months, 2 weeks ago
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


On Thu, 23 Oct 2025 15:02:30 +0800, Haotian Zhang wrote:
> The generic_handle_domain_irq() function resolves the hardware IRQ
> internally. The driver performed a duplicative mapping by calling
> irq_find_mapping() first, which could lead to an RCU stall.
> 
> Delete the redundant irq_find_mapping() call and pass the hardware IRQ
> directly to generic_handle_domain_irq().
> 
> [...]

Applied, thanks!

[1/1] gpio: ljca: Fix duplicated IRQ mapping
      https://git.kernel.org/brgl/linux/c/7d168362aedeca451ac22724f90040296dccca14

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Re: [PATCH] gpio: ljca: Fix duplicated IRQ mapping
Posted by Bartosz Golaszewski 3 months, 2 weeks ago
On Thu, Oct 23, 2025 at 9:02 AM Haotian Zhang <vulab@iscas.ac.cn> wrote:
>
> The generic_handle_domain_irq() function resolves the hardware IRQ
> internally. The driver performed a duplicative mapping by calling
> irq_find_mapping() first, which could lead to an RCU stall.
>
> Delete the redundant irq_find_mapping() call and pass the hardware IRQ
> directly to generic_handle_domain_irq().
>
> Fixes: c5a4b6fd31e8 ("gpio: Add support for Intel LJCA USB GPIO driver")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---

Andy: this looks correct to me and you already sent your PR with
fixes, should I take it directly into my fixes tree for v6.18-rc3?

Bart
Re: [PATCH] gpio: ljca: Fix duplicated IRQ mapping
Posted by Andy Shevchenko 3 months, 2 weeks ago
On Thu, Oct 23, 2025 at 10:09:05AM +0200, Bartosz Golaszewski wrote:
> On Thu, Oct 23, 2025 at 9:02 AM Haotian Zhang <vulab@iscas.ac.cn> wrote:
> >
> > The generic_handle_domain_irq() function resolves the hardware IRQ
> > internally. The driver performed a duplicative mapping by calling
> > irq_find_mapping() first, which could lead to an RCU stall.
> >
> > Delete the redundant irq_find_mapping() call and pass the hardware IRQ
> > directly to generic_handle_domain_irq().
> 
> Andy: this looks correct to me and you already sent your PR with
> fixes, should I take it directly into my fixes tree for v6.18-rc3?

Yes, please. This driver is out of my scope, it should have its own maintainers
(from Intel). If not, I may rise this problem internally.

-- 
With Best Regards,
Andy Shevchenko