Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Saubhik Mukherjee <saubhik.mukherjee@gmail.com>
Cc: jirislaby@kernel.org, linux-serial@vger.kernel.org,
	ldv-project@linuxtesting.org, andrianov@ispras.ru
Subject: Re: [question] Is it possible to remove an active port (without shutdown)?
Date: Fri, 11 Jun 2021 11:47:08 +0200	[thread overview]
Message-ID: <YMMxHFkhr7UDgk4o@kroah.com> (raw)
In-Reply-To: <07b2ccfa-cf98-54a2-d03c-50507de06d52@gmail.com>

On Fri, Jun 11, 2021 at 03:03:42PM +0530, Saubhik Mukherjee wrote:
> Consider the following events involving drivers/tty/serial/owl-uart.c:
> 
> Suppose the driver is registered, and the owl_uart_probe() was called.
> Then uart_startup() can be called in serial core. This calls
> owl_uart_startup() which registers the interrupt handler owl_uart_irq.
> 
> Now suppose uart_remove_one_port() in serial core is called. This
> detaches port from the core. This calls owl_uart_release_port(port).
> This writes NULL to port->membase after iounmap of port->membase from
> port->dev.
> 
> During this point, an interrupt is triggered and the interrupt callback
> owl_uart_irq() is called (parallel with uart_remove_one_port()). This
> tries to read port->membase to send or receive chars (with spinlock on
> port->lock). This introduces a race condition on port->membase.
> 
> QUESTION: Is it possible to remove an active port (without shutdown)?

You can remove it, if the driver is set up to do so properly.  Odds are
the owl-uart code is not written to expect that to ever happen.

How are you "removing" an active port?  What triggers this action?

thanks,

greg k-h

  reply	other threads:[~2021-06-11  9:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  9:33 [question] Is it possible to remove an active port (without shutdown)? Saubhik Mukherjee
2021-06-11  9:47 ` Greg KH [this message]
2021-06-14  9:57   ` Saubhik Mukherjee
2021-06-14 10:01     ` Greg KH

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=YMMxHFkhr7UDgk4o@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andrianov@ispras.ru \
    --cc=jirislaby@kernel.org \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=saubhik.mukherjee@gmail.com \
    /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