[PATCH] pinctrl: single: free the IRQ on domain creation failure

Myeonghun Pak posted 1 patch 1 week, 5 days ago
drivers/pinctrl/pinctrl-single.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] pinctrl: single: free the IRQ on domain creation failure
Posted by Myeonghun Pak 1 week, 5 days ago
pcs_irq_init_chained_handler() requests a shared IRQ on affected SoCs, but
its domain creation failure path only removes a chained handler. That does
not release the action installed by request_irq(). The probe can continue
without interrupt support while leaving the shared IRQ action registered.

Use pcs_irq_free() to undo the appropriate type of handler registration.
At this point pcs->domain is NULL, so the helper only releases the parent
IRQ handler. Then mark the IRQ invalid, as the other initialization error
paths already do, to prevent another release from a later probe unwind or
remove.

This issue was identified during our ongoing static-analysis research while
reviewing kernel code.

Fixes: 3e6cee1786a1 ("pinctrl: single: Add support for wake-up interrupts")
Cc: stable@vger.kernel.org
Assisted-by: OpenAI:GPT-5.6
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
 drivers/pinctrl/pinctrl-single.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 4d5f85b7e..e0eb7240a 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1628,7 +1628,8 @@ static int pcs_irq_init_chained_handler(struct pcs_device *pcs,
 					       &pcs_irqdomain_ops,
 					       pcs_soc);
 	if (!pcs->domain) {
-		irq_set_chained_handler(pcs_soc->irq, NULL);
+		pcs_irq_free(pcs);
+		pcs_soc->irq = -1;
 		return -EINVAL;
 	}
Re: [PATCH] pinctrl: single: free the IRQ on domain creation failure
Posted by Linus Walleij 1 week, 1 day ago
On Sun, Sep 13, 2026 at 6:03 AM Myeonghun Pak <mhun512@gmail.com> wrote:

> pcs_irq_init_chained_handler() requests a shared IRQ on affected SoCs, but
> its domain creation failure path only removes a chained handler. That does
> not release the action installed by request_irq(). The probe can continue
> without interrupt support while leaving the shared IRQ action registered.
>
> Use pcs_irq_free() to undo the appropriate type of handler registration.
> At this point pcs->domain is NULL, so the helper only releases the parent
> IRQ handler. Then mark the IRQ invalid, as the other initialization error
> paths already do, to prevent another release from a later probe unwind or
> remove.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.
>
> Fixes: 3e6cee1786a1 ("pinctrl: single: Add support for wake-up interrupts")
> Cc: stable@vger.kernel.org
> Assisted-by: OpenAI:GPT-5.6
> Co-developed-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Ijae Kim <ae878000@gmail.com>
> Signed-off-by: Myeonghun Pak <mhun512@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij