Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arina Kharlamova" <arina.kharlamova@mbzuai.ac.ae>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: serial: ip22zilog: Free the interrupt on unbind
Date: Tue, 01 Dec 2026 19:35:19 +0000	[thread overview]
Message-ID: <sashiko-outbox-244089@kernel.org> (raw)
In-Reply-To: <20261201-s2p-d26-v1-1-a39b4ded58a6@mbzuai.ac.ae>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] tty: serial: ip22zilog: race between IRQ and port
  teardown/re-init in ip22zilog_probe()
--

commit d9c7f1ddd8187e669adae449f28b7838ada8e286
Author: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>

tty: serial: ip22zilog: Free the interrupt on unbind

This commit switches ip22zilog_probe() from request_irq() to
devm_request_irq() so the interrupt handler is freed when the driver is
unbound.

> diff --git a/drivers/tty/serial/ip22zilog.c b/drivers/tty/serial/ip22zilog.c
> index 3fb8fdf8a853a..e887e01fb4d46 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");
>  	}

[Severity: Medium]
Can using devm_request_irq() here leave ip22zilog_interrupt() active
while the ports are being removed on unbind or re-initialized on a later
bind?

On unbind, __device_release_driver() runs ip22zilog_remove() before
devres releases the IRQ.  For a console port, ip22zilog_shutdown() leaves
Z8530 interrupts enabled, and uart_remove_one_port() detaches the port
without clearing up->port.state in the static ip22zilog_port_table[].

If the driver is then bound again, devm_request_irq() installs
ip22zilog_interrupt() before uart_add_one_port() runs:

CPU0                                    CPU1 (<hardirq>)
ip22zilog_probe()
  devm_request_irq()
                                        ip22zilog_interrupt()
                                          uart_port_lock(&up->port)
  uart_add_one_port()
    ...
      uart_port_spin_lock_init()  <-- re-inits held lock

An interrupt during unbind or re-probe can also see the stale
up->port.state pointer in ip22zilog_receive_chars() or
ip22zilog_transmit_chars() and push flip-buffer work or wakeups on a
removed port, or corrupt up->port.lock.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-s2p-d26-v1-1-a39b4ded58a6@mbzuai.ac.ae?part=1

  reply	other threads:[~2026-12-01 19:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-12-01 20:07 ` Greg Kroah-Hartman

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=sashiko-outbox-244089@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=arina.kharlamova@mbzuai.ac.ae \
    --cc=linux-serial@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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