Thread (4 messages) 4 messages, 2 authors, 2021-06-14

Re: [question] Is it possible to remove an active port (without shutdown)?

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-06-11 09:47:15

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help