Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] tty: serial: ip22zilog: Free the interrupt on unbind
@ 2026-12-01 19:20 Arina Kharlamova via B4 Relay
  2026-12-01 19:35 ` sashiko-bot
  2026-12-01 20:07 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-12-01 19:20 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Thomas Bogendoerfer
  Cc: linux-kernel, linux-serial, stable, Arina Kharlamova

From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>

ip22zilog_probe() requests the interrupt with request_irq(), and
nothing frees it. After the driver is unbound the handler stays
installed, and the next probe fails to request the interrupt and
calls panic().

Request the interrupt with devm_request_irq(), so it is freed when the
driver is unbound.

Fixes: 3fc36ae6abd2 ("tty: serial: ip22zilog: Use platform device for probing")
Cc: stable@vger.kernel.org
Signed-off-by: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
---
The interrupt is never freed, so binding the driver again panics.

I found this with spec2patch. It has formal specifications of kernel APIs
such as devres, runtime PM, clocks and locks. Each one says what a call
acquires and releases and what a driver has to undo on the error and
remove paths. I checked this driver against them. With the help of an AI
coding assistant (Claude); I reviewed the analysis and the fix.
Compile-tested only, not tested on hardware.
---
 drivers/tty/serial/ip22zilog.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
index 3fb8fdf8a853..e887e01fb4d4 100644
--- a/drivers/tty/serial/ip22zilog.c
+++ b/drivers/tty/serial/ip22zilog.c
@@ -1091,8 +1091,8 @@ static int ip22zilog_probe(struct platform_device *pdev)
 	up->port.dev = &pdev->dev;
 	up->port.irq = irq;
 
-	if (request_irq(irq, ip22zilog_interrupt, 0,
-			"IP22-Zilog", NULL)) {
+	if (devm_request_irq(&pdev->dev, irq, ip22zilog_interrupt, 0,
+			     "IP22-Zilog", NULL)) {
 		panic("IP22-Zilog: Unable to register zs interrupt handler.\n");
 	}
 

---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261201-s2p-d26-c6c65714abb8

Best regards,
--  
Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 19:20 [PATCH] tty: serial: ip22zilog: Free the interrupt on unbind Arina Kharlamova via B4 Relay
2026-12-01 19:35 ` sashiko-bot
2026-12-01 20:07 ` Greg Kroah-Hartman

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